Skip to content

Instantly share code, notes, and snippets.

@ariellephan
Created January 31, 2012 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariellephan/1710007 to your computer and use it in GitHub Desktop.
Save ariellephan/1710007 to your computer and use it in GitHub Desktop.
Ruby 1.2
class Person
attr_accessor :name, :age
def initialize(name, age)
@name = name
@age = age.to_i
end
def inspect
"#@name (#@age)"
end
end
p1 = Person.new('elmo', 4)
p2 = Person.new('zoe', 7)
p1 # -> elmo (4)
p2 # -> zoe (7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment