Class: Redis::Attrs::FilteredSet

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

Instance Method Summary collapse

Instance Method Details

#add(value) ⇒ Object



32
33
34
35
# File 'lib/redis-attrs/objects_extensions.rb', line 32

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

#delete(value) ⇒ Object



50
51
52
53
# File 'lib/redis-attrs/objects_extensions.rb', line 50

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

#member?(value) ⇒ Boolean

Returns:



45
46
47
48
# File 'lib/redis-attrs/objects_extensions.rb', line 45

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

#merge(*values) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/redis-attrs/objects_extensions.rb', line 37

def merge(*values)
  if options[:filter]
    filter = options[:filter]
    values = values.map { |value| filter.call(value) }
  end
  super
end