Class: Treefell::Filters::EnvFilter
- Inherits:
-
Object
- Object
- Treefell::Filters::EnvFilter
- Defined in:
- lib/treefell/filters/env_filter.rb
Constant Summary collapse
- ENV_VAR_KEY =
'DEBUG'- ENV_VAR_LOOKUP =
-> { ENV[ENV_VAR_KEY] }
- WILDCARD =
'*'
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(namespace, message) ⇒ Object
-
#initialize(value: ENV_VAR_LOOKUP) ⇒ EnvFilter
constructor
A new instance of EnvFilter.
Constructor Details
#initialize(value: ENV_VAR_LOOKUP) ⇒ EnvFilter
8 9 10 |
# File 'lib/treefell/filters/env_filter.rb', line 8 def initialize(value: ENV_VAR_LOOKUP) @value_proc = value end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 |
# File 'lib/treefell/filters/env_filter.rb', line 18 def ==(other) other.is_a?(self.class) && other.instance_variable_get(:@value_proc) == @value_proc end |
#call(namespace, message) ⇒ Object
12 13 14 15 16 |
# File 'lib/treefell/filters/env_filter.rb', line 12 def call(namespace, ) @value = @value_proc.call is_mentioned?(namespace) is_mentioned?(namespace) || is_mentioned?(WILDCARD) end |