Class: VK::TOGGLE
- Inherits:
-
O
show all
- Defined in:
- lib/valkey/objects.rb
Instance Attribute Summary
Attributes inherited from O
#key
Instance Method Summary
collapse
Methods inherited from O
#delete!, #expire, #initialize
Constructor Details
This class inherits a constructor from VK::O
Instance Method Details
#exist? ⇒ Boolean
337
338
339
|
# File 'lib/valkey/objects.rb', line 337
def exist?
VK.redis.call("GET", key) ? true : false
end
|
#value ⇒ Object
330
331
332
333
334
335
336
|
# File 'lib/valkey/objects.rb', line 330
def value
x = VK.redis.call("GET", key) == 'true' ? true : false
if @opts.has_key?(:flush) == true
delete!
end
return x
end
|
#value! ⇒ Object
343
344
345
346
347
348
349
|
# File 'lib/valkey/objects.rb', line 343
def value!
if self.value == true || self.value == nil
self.value = false
else
self.value = true
end
end
|
#value=(x) ⇒ Object
340
341
342
|
# File 'lib/valkey/objects.rb', line 340
def value= x
VK.redis.call("SET", key, "#{x.to_s}")
end
|