Say I have two hashes that share one key (for example "foo") but different values. Now I want to create a method with one attribute that puts out the value of the key depending on which hash I chose as attribute. How do I do that?
I have tried:
def put_hash(hash)
puts hash("foo")
end
but when I call this function with a hash it gives me the error below:
undefined method `hash' for main:Object (NoMethodError)