Class: Kredis::Types::OrderedSet
Instance Attribute Summary collapse
Attributes inherited from Proxying
#key, #proxy
Instance Method Summary
collapse
#initialize
Methods inherited from Proxying
#failsafe, #initialize, proxying, #unproxied_redis
Instance Attribute Details
#limit ⇒ Object
Returns the value of attribute limit.
9
10
11
|
# File 'lib/kredis/types/ordered_set.rb', line 9
def limit
@limit
end
|
#typed ⇒ Object
Returns the value of attribute typed.
8
9
10
|
# File 'lib/kredis/types/ordered_set.rb', line 8
def typed
@typed
end
|
Instance Method Details
#append(elements) ⇒ Object
Also known as:
<<
28
29
30
|
# File 'lib/kredis/types/ordered_set.rb', line 28
def append(elements)
insert(elements)
end
|
#elements ⇒ Object
Also known as:
to_a
11
12
13
|
# File 'lib/kredis/types/ordered_set.rb', line 11
def elements
strings_to_types(zrange(0, -1) || [], typed)
end
|
#include?(element) ⇒ Boolean
20
21
22
|
# File 'lib/kredis/types/ordered_set.rb', line 20
def include?(element)
!!zscore(type_to_string(element, typed))
end
|
#prepend(elements) ⇒ Object
24
25
26
|
# File 'lib/kredis/types/ordered_set.rb', line 24
def prepend(elements)
insert(elements, prepending: true)
end
|
#remove(*elements) ⇒ Object
16
17
18
|
# File 'lib/kredis/types/ordered_set.rb', line 16
def remove(*elements)
zrem(types_to_strings(elements, typed))
end
|