Class: RedisArray::RedisHashGroup
- Inherits:
-
Object
- Object
- RedisArray::RedisHashGroup
- Defined in:
- lib/redisarray/redis_hash_group.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ RedisHashGroup
constructor
A new instance of RedisHashGroup.
Constructor Details
#initialize(options = {}) ⇒ RedisHashGroup
Returns a new instance of RedisHashGroup.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/redisarray/redis_hash_group.rb', line 5 def initialize ={} .reverse_merge!(:existing_group_name => nil) if [:prefix] @name = [:prefix] + "-" + rand(100000).to_s while not RedisTable.get_redis.keys("#{@name}:*").empty? do @name = [:prefix] + "-" + rand(100000).to_s end elsif [:existing_group_name].nil? @name = rand(100000).to_s while not RedisTable.get_redis.keys("#{@name}:*").empty? do @name = rand(100000).to_s end else @name = [:existing_group_name].to_s end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/redisarray/redis_hash_group.rb', line 3 def name @name end |