Class: Rhoconnect::StoreOrm::SetProxy

Inherits:
FieldProxy
  • Object
show all
Defined in:
lib/rhoconnect/store_orm.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from FieldProxy

#initialize

Constructor Details

This class inherits a constructor from Rhoconnect::StoreOrm::FieldProxy

Instance Method Details

#<<(v) ⇒ Object Also known as: add



326
327
328
# File 'lib/rhoconnect/store_orm.rb', line 326

def <<(v)
  @store_db.sadd @name, @marshal.dump(v)
end

#delete(v) ⇒ Object Also known as: remove



331
332
333
# File 'lib/rhoconnect/store_orm.rb', line 331

def delete(v)
  @store_db.srem @name, @marshal.dump(v)
end

#include?(v) ⇒ Boolean Also known as: has_key?, member?

Returns:

  • (Boolean)


336
337
338
# File 'lib/rhoconnect/store_orm.rb', line 336

def include?(v)
  @store_db.sismember @name, @marshal.dump(v)
end

#membersObject



342
343
344
345
346
347
348
349
# File 'lib/rhoconnect/store_orm.rb', line 342

def members
  members = @store_db.smembers(@name)
  if members
    members.map { |v| @marshal.load(v) }
  else 
    []
  end
end