Class: Redis::Attrs::FilteredList

Inherits:
List
  • Object
show all
Defined in:
lib/redis-attrs/objects_extensions.rb

Instance Method Summary collapse

Instance Method Details

#delete(name, count = 0) ⇒ Object


25
26
27
28
# File 'lib/redis-attrs/objects_extensions.rb', line 25

def delete(name, count = 0)
  name = options[:filter].call(name) if options[:filter]
  super
end

#insert(where, pivot, value) ⇒ Object

Add a member before or after pivot in the list. Redis: LINSERT


11
12
13
14
15
16
17
# File 'lib/redis-attrs/objects_extensions.rb', line 11

def insert(where, pivot, value)
  if options[:filter]
    value = options[:filter].call(value)
    pivot = options[:filter].call(pivot)
  end
  super
end

#push(value) ⇒ Object


5
6
7
8
# File 'lib/redis-attrs/objects_extensions.rb', line 5

def push(value)
  value = options[:filter].call(value) if options[:filter]
  super
end

#unshift(value) ⇒ Object

Add a member to the start of the list. Redis: LPUSH


20
21
22
23
# File 'lib/redis-attrs/objects_extensions.rb', line 20

def unshift(value)
  value = options[:filter].call(value) if options[:filter]
  super
end