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.
7 8 9 |
# File 'lib/rshade/filter/variable_filter.rb', line 7 def initialize @matchers = [] end |
Instance Attribute Details
#matchers ⇒ Object (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 |
#name ⇒ Object
11 12 13 |
# File 'lib/rshade/filter/variable_filter.rb', line 11 def name :variable_filter end |
#priority ⇒ Object
15 16 17 |
# File 'lib/rshade/filter/variable_filter.rb', line 15 def priority 2 end |