Class: Vanilla::SoupWithTimestamps
- Inherits:
-
Soup
- Object
- Soup
- Vanilla::SoupWithTimestamps
- Defined in:
- lib/vanilla/soup_with_timestamps.rb
Instance Method Summary collapse
- #<<(attributes) ⇒ Object
-
#initialize(config) ⇒ SoupWithTimestamps
constructor
A new instance of SoupWithTimestamps.
- #new_snip(attributes) ⇒ Object
Constructor Details
#initialize(config) ⇒ SoupWithTimestamps
Returns a new instance of SoupWithTimestamps.
6 7 8 |
# File 'lib/vanilla/soup_with_timestamps.rb', line 6 def initialize(config) super(Soup.new(config)) end |
Instance Method Details
#<<(attributes) ⇒ Object
10 11 12 13 14 |
# File 'lib/vanilla/soup_with_timestamps.rb', line 10 def <<(attributes) attributes[:created_at] ||= Time.now attributes[:updated_at] = Time.now super end |
#new_snip(attributes) ⇒ Object
16 17 18 |
# File 'lib/vanilla/soup_with_timestamps.rb', line 16 def new_snip(attributes) Snip.new(attributes, self) end |