Class: Rhoconnect::StoreOrm::ListProxy
Overview
Instance Method Summary
collapse
Methods inherited from FieldProxy
#initialize
Instance Method Details
#<<(v) ⇒ Object
Also known as:
push_tail
285
286
287
|
# File 'lib/rhoconnect/store_orm.rb', line 285
def <<(v)
@store_db.rpush @name, @marshal.dump(v)
end
|
#[](from, to = nil) ⇒ Object
Also known as:
range
302
303
304
305
306
307
308
|
# File 'lib/rhoconnect/store_orm.rb', line 302
def [](from, to = nil)
if to.nil?
@marshal.load(@store_db.lindex(@name, from))
else
@store_db.lrange(@name, from, to).map! { |v| @marshal.load(v) }
end
end
|
#[]=(index, v) ⇒ Object
Also known as:
set
311
312
313
|
# File 'lib/rhoconnect/store_orm.rb', line 311
def []=(index, v)
@store_db.lset(@name, index, @marshal.dump(v))
end
|
#include?(v) ⇒ Boolean
316
317
318
|
# File 'lib/rhoconnect/store_orm.rb', line 316
def include?(v)
@store_db.exists(@name, @marshal.dump(v))
end
|
#pop_head ⇒ Object
298
299
300
|
# File 'lib/rhoconnect/store_orm.rb', line 298
def pop_head
@marshal.load(@store_db.lpop(@name))
end
|
#pop_tail ⇒ Object
294
295
296
|
# File 'lib/rhoconnect/store_orm.rb', line 294
def pop_tail
@marshal.load(@store_db.rpop(@name))
end
|
#push_head(v) ⇒ Object
290
291
292
|
# File 'lib/rhoconnect/store_orm.rb', line 290
def push_head(v)
@store_db.lpush @name, @marshal.dump(v)
end
|
#remove(count, v) ⇒ Object
320
321
322
|
# File 'lib/rhoconnect/store_orm.rb', line 320
def remove(count, v)
@store_db.lrem(@name, count, @marshal.dump(v))
end
|