Skip to content

Instantly share code, notes, and snippets.

@p886
Last active August 29, 2015 13:56
Show Gist options
  • Save p886/9229925 to your computer and use it in GitHub Desktop.
Save p886/9229925 to your computer and use it in GitHub Desktop.
# this:
person = Struct.new(:name, :age, :human)
# …is functionally equivalent to this:
class Person
attr_accessor :name, :age, :human
def initialize name, age, human
@name = name
@age = age
@human = human
end
end
# …and can be used like so
me = person.new("Phil", 9000, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment