Module: Rivendell::Import::Tasking::Cart
- Included in:
- Rivendell::Import::Task
- Defined in:
- lib/rivendell/import/tasking/cart.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
18 19 20 21 22 |
# File 'lib/rivendell/import/tasking/cart.rb', line 18 def self.included(base) base.class_eval do before_save :write_cart end end |
Instance Method Details
#cart ⇒ Object
8 9 10 11 12 |
# File 'lib/rivendell/import/tasking/cart.rb', line 8 def cart @cast ||= Rivendell::Import::Cart.new(self).tap do |cart| cart.from_json(raw_cart, false) if raw_cart end end |
#raw_cart ⇒ Object
4 5 6 |
# File 'lib/rivendell/import/tasking/cart.rb', line 4 def raw_cart read_attribute :cart end |
#write_cart ⇒ Object
14 15 16 |
# File 'lib/rivendell/import/tasking/cart.rb', line 14 def write_cart write_attribute :cart, (cart.present? ? cart.to_json : nil) end |