Skip to content

Instantly share code, notes, and snippets.

@djsun
Created January 4, 2010 21:02
Show Gist options
  • Save djsun/268860 to your computer and use it in GitHub Desktop.
Save djsun/268860 to your computer and use it in GitHub Desktop.
class Person
attr_accessor :name
def initialize(name)
@name = name
end
end
people = {}
person_1 = Person.new("Saul")
person_2 = Person.new("John")
people[person_1] = 7
people[person_2] = 5
puts people.inspect
person_1.name = "Paul"
puts people.inspect
# {#<Person:0x1001249d0 @name="Saul">=>7, #<Person:0x100124980 @name="John">=>5}
# {#<Person:0x1001249d0 @name="Paul">=>7, #<Person:0x100124980 @name="John">=>5}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment