Module: Ur::Middleware
- Included in:
- FaradayMiddleware, RackMiddleware
- Defined in:
- lib/ur/middleware.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #begin_request(ur) ⇒ Object
- #finish_request(ur) ⇒ Object
- #initialize(app, options = {}) ⇒ Object
- #invoke_callback(name, *a, &b) ⇒ Object
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
11 12 13 |
# File 'lib/ur/middleware.rb', line 11 def app @app end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/ur/middleware.rb', line 12 def @options end |
Instance Method Details
#begin_request(ur) ⇒ Object
14 15 16 |
# File 'lib/ur/middleware.rb', line 14 def begin_request(ur) ur..begin! end |
#finish_request(ur) ⇒ Object
18 19 20 21 |
# File 'lib/ur/middleware.rb', line 18 def finish_request(ur) ur.(@options[:logger]) ur..finish! end |
#initialize(app, options = {}) ⇒ Object
7 8 9 10 |
# File 'lib/ur/middleware.rb', line 7 def initialize(app, = {}) @app = app @options = end |
#invoke_callback(name, *a, &b) ⇒ Object
23 24 25 26 27 |
# File 'lib/ur/middleware.rb', line 23 def invoke_callback(name, *a, &b) if @options[name] @options[name].call(*a, &b) end end |