Class: Kredis::Types::List
Instance Attribute Summary collapse
Attributes inherited from Proxying
#key, #proxy, #redis
Instance Method Summary
collapse
Methods inherited from Proxying
#initialize, proxying
Instance Attribute Details
#typed ⇒ Object
Returns the value of attribute typed.
4
5
6
|
# File 'lib/kredis/types/list.rb', line 4
def typed
@typed
end
|
Instance Method Details
#append(*elements) ⇒ Object
Also known as:
<<
19
20
21
|
# File 'lib/kredis/types/list.rb', line 19
def append(*elements)
rpush types_to_strings(elements) if elements.flatten.any?
end
|
#elements ⇒ Object
Also known as:
to_a
6
7
8
|
# File 'lib/kredis/types/list.rb', line 6
def elements
strings_to_types(lrange(0, -1) || [], typed)
end
|
#prepend(*elements) ⇒ Object
15
16
17
|
# File 'lib/kredis/types/list.rb', line 15
def prepend(*elements)
lpush types_to_strings(elements) if elements.flatten.any?
end
|
#remove(*elements) ⇒ Object
11
12
13
|
# File 'lib/kredis/types/list.rb', line 11
def remove(*elements)
types_to_strings(elements).each { |element| lrem 0, element }
end
|