Class: Kredis::Types::Scalar
Instance Attribute Summary collapse
Attributes inherited from Proxying
#key, #proxy, #redis
Instance Method Summary
collapse
Methods inherited from Proxying
#initialize, proxying
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
4
5
6
|
# File 'lib/kredis/types/scalar.rb', line 4
def default
@default
end
|
#typed ⇒ Object
Returns the value of attribute typed.
4
5
6
|
# File 'lib/kredis/types/scalar.rb', line 4
def typed
@typed
end
|
Instance Method Details
#assigned? ⇒ Boolean
18
19
20
|
# File 'lib/kredis/types/scalar.rb', line 18
def assigned?
exists?
end
|
#clear ⇒ Object
22
23
24
|
# File 'lib/kredis/types/scalar.rb', line 22
def clear
del
end
|
#to_s ⇒ Object
14
15
16
|
# File 'lib/kredis/types/scalar.rb', line 14
def to_s
get || default&.to_s
end
|
#value ⇒ Object
10
11
12
|
# File 'lib/kredis/types/scalar.rb', line 10
def value
string_to_type(get, typed) || default
end
|
#value=(value) ⇒ Object
6
7
8
|
# File 'lib/kredis/types/scalar.rb', line 6
def value=(value)
set type_to_string(value)
end
|