Skip to content

Instantly share code, notes, and snippets.

@Supernats
Created October 19, 2015 21:22
Show Gist options
  • Select an option

  • Save Supernats/bdb0626bd548f075aa91 to your computer and use it in GitHub Desktop.

Select an option

Save Supernats/bdb0626bd548f075aa91 to your computer and use it in GitHub Desktop.
class Wrapper
attr_reader :string
def initialize(string)
@string = string
end
def upcase!
string.upcase!
end
end
hash = { Wrapper.new("apple") => "pie" }
# => {#<Wrapper:0x007fe2114fc388 @string="apple">=>"pie"}
hash.keys.each { |k| k.upcase! }
# => [#<Wrapper:0x007fe2114fc388 @string="APPLE">]
hash
# => {#<Wrapper:0x007fe2114fc388 @string="APPLE">=>"pie"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment