Class: RShade::Filter::VariableFilter
- Inherits:
-
AbstractFilter
- Object
- AbstractFilter
- RShade::Filter::VariableFilter
- Defined in:
- lib/rshade/filter/variable_filter.rb
Constant Summary collapse
- NAME =
:variable_filter
Instance Attribute Summary collapse
-
#matchers ⇒ Object
readonly
Returns the value of attribute matchers.
Instance Method Summary collapse
- #call(event) ⇒ Object
- #config_call(&block) ⇒ Object
-
#initialize ⇒ VariableFilter
constructor
A new instance of VariableFilter.
- #name ⇒ Object
- #priority ⇒ Object
Methods inherited from AbstractFilter
Constructor Details
#initialize ⇒ VariableFilter
Returns a new instance of VariableFilter.
10 11 12 13 |
# File 'lib/rshade/filter/variable_filter.rb', line 10 def initialize super @matchers = [] end |
Instance Attribute Details
#matchers ⇒ Object (readonly)
Returns the value of attribute matchers.
6 7 8 |
# File 'lib/rshade/filter/variable_filter.rb', line 6 def matchers @matchers end |
Instance Method Details
#call(event) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/rshade/filter/variable_filter.rb', line 23 def call(event) matchers.each do |match| event.vars.each do |name, hash| return true if match.call(name, hash[:value]) end end false end |
#config_call(&block) ⇒ Object
32 33 34 |
# File 'lib/rshade/filter/variable_filter.rb', line 32 def config_call(&block) matchers << block end |
#name ⇒ Object
15 16 17 |
# File 'lib/rshade/filter/variable_filter.rb', line 15 def name :variable_filter end |
#priority ⇒ Object
19 20 21 |
# File 'lib/rshade/filter/variable_filter.rb', line 19 def priority 2 end |