Skip to content

Instantly share code, notes, and snippets.

View pinkopaque22's full-sized avatar

Patricia Ehrhardt pinkopaque22

View GitHub Profile
INSTRUCTIONS
Create a method named merge_us that expects two arguments and combines them, assuming they're hashes. The Hash class has a method named merge that will be helpful to you.
Create a method named my_keys that takes a hash argument and returns an Array of its keys. The Hash class has a method named keys that will be helpful to you.
Create a method named do_i_have? which expects two arguments. The arguments should represent a Hash and Array of keys. do_i_have? should return true if the Array has all of the keys in the hash, and false if it does not. To create this method, you could start with something like this:
def do_i_have?(hash, array_of_keys)
end
You want to make sure that every key in the hash argument is also contained in the array_of_keys argument. (Remember that hash is expected to be Hash and array_of_keys is expected to be an Array). To compare two objects for equality, you need them to be evaluated as the same object type. That is, you can't explicitly compare a Hash to an Array, but y