Class: Meddler::PreInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/meddler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, skip_app, rule = nil) ⇒ PreInterceptor

Returns a new instance of PreInterceptor.



41
42
43
44
45
# File 'lib/meddler.rb', line 41

def initialize(app, skip_app, rule = nil)
  @app = app
  @skip_app = skip_app
  @rule = rule
end

Instance Attribute Details

#skip_appObject

Returns the value of attribute skip_app.



39
40
41
# File 'lib/meddler.rb', line 39

def skip_app
  @skip_app
end

Instance Method Details

#call(env) ⇒ Object



47
48
49
# File 'lib/meddler.rb', line 47

def call(env)
  response = @rule.nil? || @rule.call(Rack::Request.new(env)) ? @app.call(env) : @skip_app.call(env)
end