Class: Vanilla::SoupWithTimestamps

Inherits:
Soup
  • Object
show all
Defined in:
lib/vanilla/soup_with_timestamps.rb

Instance Method Summary collapse

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