Class: RFlags::RedisFlag
- Inherits:
-
Object
- Object
- RFlags::RedisFlag
- Defined in:
- lib/rflags/redis_flag.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(redis, key) ⇒ RedisFlag
constructor
A new instance of RedisFlag.
- #reset ⇒ Object
- #set ⇒ Object
- #set? ⇒ Boolean
Constructor Details
#initialize(redis, key) ⇒ RedisFlag
5 6 7 8 |
# File 'lib/rflags/redis_flag.rb', line 5 def initialize(redis, key) @redis = redis @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/rflags/redis_flag.rb', line 3 def key @key end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
3 4 5 |
# File 'lib/rflags/redis_flag.rb', line 3 def redis @redis end |
Instance Method Details
#reset ⇒ Object
18 19 20 |
# File 'lib/rflags/redis_flag.rb', line 18 def reset redis.del(key) end |
#set ⇒ Object
14 15 16 |
# File 'lib/rflags/redis_flag.rb', line 14 def set redis.set(key, '') end |
#set? ⇒ Boolean
10 11 12 |
# File 'lib/rflags/redis_flag.rb', line 10 def set? !redis.get(key).nil? end |