Class: Deflectable::Watcher
- Inherits:
-
Object
- Object
- Deflectable::Watcher
- Defined in:
- lib/deflectable/watcher.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, build_options = {}, &block) ⇒ Watcher
constructor
A new instance of Watcher.
Constructor Details
#initialize(app, build_options = {}, &block) ⇒ Watcher
Returns a new instance of Watcher.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/deflectable/watcher.rb', line 6 def initialize(app, ={}, &block) @app = app @filtering = nil @options = { :log => false, :logger => nil, :log_format => 'deflect(%s): %s', :log_date_format => '%m/%d/%Y', :whitelist => [], :blacklist => [], :config_path => nil, }.merge() @options = @options.merge(block.call) if block_given? configure_check! end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/deflectable/watcher.rb', line 4 def @options end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 |
# File 'lib/deflectable/watcher.rb', line 22 def call(env) return reject!(env) unless permit?(env) status, headers, body = @app.call(env) [status, headers, body] end |