Created
June 25, 2012 17:18
-
-
Save kornypoet/2989976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'gorillib/model' | |
| class Joke | |
| include Gorillib::Model | |
| field :is_so_fat, String, :default => "When she sits around the house, she sits *AROUND* the house" | |
| field :wears, String | |
| end | |
| # >> Joke.field_names | |
| # => [:is_so_fat, :wears] | |
| # >> yo_mama = Joke.receive | |
| # => #<Joke> | |
| # >> yo_mama.is_so_fat | |
| # => "When she sits around the house, she sits *AROUND* the house" | |
| # >> yo_mama.wears = "combat boots" | |
| # => "combat boots" | |
| # >> yo_mama.wears | |
| # => "combat boots" | |
| # >> yo_mama = Joke.receive(:is_so_fat => "She puts on her belt with a boomerang") | |
| # => #<Joke is_so_fat="She puts on her belt with a boomerang"> | |
| # >> yo_mama.attributes | |
| # => {:is_so_fat=>"She puts on her belt with a boomerang", :wears=>nil} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment