Class: Seinfeld::Entry
- Inherits:
-
Object
- Object
- Seinfeld::Entry
- Defined in:
- lib/seinfeld.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(attributes = {}) ⇒ Entry
constructor
A new instance of Entry.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Entry
Returns a new instance of Entry.
8 9 10 11 |
# File 'lib/seinfeld.rb', line 8 def initialize(attributes={}) @attributes = attributes @attributes['date'] ||= Date.today end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/seinfeld.rb', line 19 def method_missing(name, *args) if attributes[name.to_s] return attributes[name.to_s] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
13 14 15 |
# File 'lib/seinfeld.rb', line 13 def attributes @attributes end |
Instance Method Details
#as_json ⇒ Object
15 16 17 |
# File 'lib/seinfeld.rb', line 15 def as_json attributes end |