Class: Driskell::Listen::Silencer::Controller
- Inherits:
-
Object
- Object
- Driskell::Listen::Silencer::Controller
- Defined in:
- lib/driskell-listen/silencer/controller.rb
Instance Method Summary collapse
- #append_ignores(*regexps) ⇒ Object
-
#initialize(silencer, default_options) ⇒ Controller
constructor
A new instance of Controller.
- #replace_with_bang_ignores(regexps) ⇒ Object
- #replace_with_only(regexps) ⇒ Object
Constructor Details
#initialize(silencer, default_options) ⇒ Controller
Returns a new instance of Controller.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/driskell-listen/silencer/controller.rb', line 4 def initialize(silencer, ) @silencer = silencer opts = @prev_silencer_options = {} rules = [:only, :ignore, :ignore!].map do |option| [option, opts[option]] if opts.key? option end _reconfigure_silencer(Hash[rules.compact]) end |
Instance Method Details
#append_ignores(*regexps) ⇒ Object
17 18 19 20 |
# File 'lib/driskell-listen/silencer/controller.rb', line 17 def append_ignores(*regexps) prev_ignores = Array(@prev_silencer_options[:ignore]) _reconfigure_silencer(ignore: [prev_ignores + regexps]) end |
#replace_with_bang_ignores(regexps) ⇒ Object
22 23 24 |
# File 'lib/driskell-listen/silencer/controller.rb', line 22 def replace_with_bang_ignores(regexps) _reconfigure_silencer(ignore!: regexps) end |
#replace_with_only(regexps) ⇒ Object
26 27 28 |
# File 'lib/driskell-listen/silencer/controller.rb', line 26 def replace_with_only(regexps) _reconfigure_silencer(only: regexps) end |