Try this:
class Array
def keys_and_values(hash_value)
new_hash={}
for k in self
new_hash.update({k,hash_value})
end
return new_hash
end
end
same_value=‘identical’
my_array=[‘a’,‘b’,‘c’,‘d’]
hash=my_array.keys_and_values(same_value)
p hash
Best regards,
Axel