Module: Ur::Middleware

Included in:
FaradayMiddleware, RackMiddleware
Defined in:
lib/ur/middleware.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



9
10
11
# File 'lib/ur/middleware.rb', line 9

def app
  @app
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/ur/middleware.rb', line 10

def options
  @options
end

Instance Method Details

#initialize(app, options = {}) ⇒ Object



5
6
7
8
# File 'lib/ur/middleware.rb', line 5

def initialize(app, options = {})
  @app = app
  @options = options
end

#invoke_callback(name, *a, &b) ⇒ Object



12
13
14
15
16
# File 'lib/ur/middleware.rb', line 12

def invoke_callback(name, *a, &b)
  if @options[name]
    @options[name].call(*a, &b)
  end
end