Class: Breadcrumbs::MemberOfSetKey

Inherits:
Key
  • Object
show all
Defined in:
lib/redis-breadcrumbs/member_of_set_key.rb

Instance Method Summary collapse

Methods inherited from Key

#to_s

Constructor Details

#initialize(member_template, set_template, clean_method, options) ⇒ MemberOfSetKey

Returns a new instance of MemberOfSetKey.



3
4
5
6
7
8
9
# File 'lib/redis-breadcrumbs/member_of_set_key.rb', line 3

def initialize member_template, set_template, clean_method, options
  @options = options || {}
  @member_template = member_template
  @set_template = set_template
  @clean_method = clean_method
  @resetable = options[:reset]
end

Instance Method Details

#clean_cmdObject



20
21
22
# File 'lib/redis-breadcrumbs/member_of_set_key.rb', line 20

def clean_cmd
  [@clean_method, @set_template, @member_template]
end

#key_nameObject



28
29
30
# File 'lib/redis-breadcrumbs/member_of_set_key.rb', line 28

def key_name
  @set_template
end

#reset_cmdObject



24
25
26
# File 'lib/redis-breadcrumbs/member_of_set_key.rb', line 24

def reset_cmd
  clean_cmd if @resetable
end

#specialize(object) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/redis-breadcrumbs/member_of_set_key.rb', line 11

def specialize object
  MemberOfSetKey.new(
    specialize_from_template(@member_template, object),
    specialize_from_template(@set_template, object),
    @clean_method,
    @options
  )
end