Sha256: 3bdf74ce4f1c45ef93c56cea745b1151e749587168168474cafdba10ac69c80f
Contents?: true
Size: 935 Bytes
Versions: 1
Compression:
Stored size: 935 Bytes
Contents
require 'zygote/memory' # An entry into the queue class CellQueueEntry < SuperModel::Base include SuperModel::Marshal::Model end # A means of storing Cell queue data for a given sku module CellQueue extend self COLLECTION = :assets ARRAY_KEY = :cell_queue Memory.load 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 def shift(key) entry = CellQueueEntry.find_by_name(key) return nil unless entry first = entry.data.shift entry.save Memory.save first end def show(key) entry = CellQueueEntry.find_by_name(key) entry ? entry.data : [] end def purge(key) entry = CellQueueEntry.find_by_name(key) entry.data = [] if entry entry.save if entry end def all() CellQueueEntry.all end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zygote-0.0.1 | lib/zygote/cell_queue.rb |