Skip to content

Instantly share code, notes, and snippets.

@pedronsouza
Created March 26, 2013 22:12
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 pedronsouza/5249798 to your computer and use it in GitHub Desktop.
Save pedronsouza/5249798 to your computer and use it in GitHub Desktop.
New method to_h
class Person
attr_accessor :name, :age
end
@person = Pessoa.new
@person.name = "Pedro Nicholas"
@person.age = 21
@person.to_h
#=> {:name => "Pedro Nicholas", :age => 21}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment