Module: Zygote::CellQueue
Overview
A means of storing Cell queue data for a given sku
Constant Summary collapse
- COLLECTION =
:assets
- ARRAY_KEY =
:cell_queue
Instance Method Summary collapse
- #all ⇒ Object
- #purge(key) ⇒ Object
- #push(key, data) ⇒ Object
- #shift(key) ⇒ Object
- #show(key) ⇒ Object
Instance Method Details
#all ⇒ Object
47 48 49 |
# File 'lib/zygote/cell_queue.rb', line 47 def all CellQueueEntry.all end |
#purge(key) ⇒ Object
41 42 43 44 45 |
# File 'lib/zygote/cell_queue.rb', line 41 def purge(key) entry = CellQueueEntry.find_by_name(key) entry.data = [] if entry entry.save if entry end |
#push(key, data) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zygote/cell_queue.rb', line 16 def push(key, data) entry = CellQueueEntry.find_by_name(key) unless entry entry = CellQueueEntry.new(name: key, data: []) entry.save end entry.data << data entry.save Memory.save end |
#shift(key) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/zygote/cell_queue.rb', line 27 def shift(key) entry = CellQueueEntry.find_by_name(key) return nil unless entry first = entry.data.shift entry.save Memory.save first end |
#show(key) ⇒ Object
36 37 38 39 |
# File 'lib/zygote/cell_queue.rb', line 36 def show(key) entry = CellQueueEntry.find_by_name(key) entry ? entry.data : [] end |