Sha256: 11fbcec700bbf3e65ea8ac0bd1d05e6a2709b61aa5a8b17b2aebc87bc96fcbe5
Contents?: true
Size: 628 Bytes
Versions: 1
Compression:
Stored size: 628 Bytes
Contents
require 'deepstream/record' module Deepstream class List < Record def initialize(*args) super @data = [] end def add(record_name) set(@data.length.to_s, record_name) unless @data.include?(record_name) end def read(version, data) @version = version.to_i data = JSON.parse(data) if data.is_a?(Array) @data.concat(data).uniq! set(@data) if @data.size > data.size end end def remove(record_name) set(@data) if @data.delete(record_name) end def all @data.map { |record_name| @client.get(record_name) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deepstream-0.2.0 | lib/deepstream/list.rb |