Skip to content

Instantly share code, notes, and snippets.

@jmkoni
Last active May 24, 2024 17:34
Show Gist options
  • Save jmkoni/89854b34c6530c002d69be020cef4d53 to your computer and use it in GitHub Desktop.
Save jmkoni/89854b34c6530c002d69be020cef4d53 to your computer and use it in GitHub Desktop.
class JustMerging
def self.updates_object(passed_in_hash)
passed_in_hash.merge!(add_this: "YAY")
return
end
end
class WeHaveAHash
def self.creating_a_hash
my_great_hash = {super_cool: true, wow: "what a great hash"}
JustMerging.updates_object(my_great_hash)
my_great_hash
end
end
result = WeHaveAHash.creating_a_hash
puts result
# {:super_cool=>true, :wow=>"what a great hash", :add_this=>"YAY"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment