Class: RShade::Filter::VariableFilter

Inherits:
AbstractFilter show all
Defined in:
lib/rshade/filter/variable_filter.rb

Constant Summary collapse

NAME =
:variable_filter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractFilter

#config

Constructor Details

#initializeVariableFilter

Returns a new instance of VariableFilter.



7
8
9
# File 'lib/rshade/filter/variable_filter.rb', line 7

def initialize
  @matchers = []
end

Instance Attribute Details

#matchersObject (readonly)

Returns the value of attribute matchers.



4
5
6
# File 'lib/rshade/filter/variable_filter.rb', line 4

def matchers
  @matchers
end

Instance Method Details

#call(event) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/rshade/filter/variable_filter.rb', line 19

def call(event)
  matchers.each do |match|
    event.vars.each do |name, value|
      return true if match.call(name, value)
    end
  end
  false
end

#config_call(&block) ⇒ Object



28
29
30
# File 'lib/rshade/filter/variable_filter.rb', line 28

def config_call(&block)
  matchers << block
end

#nameObject



11
12
13
# File 'lib/rshade/filter/variable_filter.rb', line 11

def name
  :variable_filter
end

#priorityObject



15
16
17
# File 'lib/rshade/filter/variable_filter.rb', line 15

def priority
  2
end