Class: Rack::LTI::Middleware
- Inherits:
-
Object
- Object
- Rack::LTI::Middleware
- Defined in:
- lib/rack/lti/middleware.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}, &block) ⇒ Middleware
constructor
A new instance of Middleware.
- #routes ⇒ Object
Constructor Details
#initialize(app, options = {}, &block) ⇒ Middleware
Returns a new instance of Middleware.
9 10 11 12 |
# File 'lib/rack/lti/middleware.rb', line 9 def initialize(app, = {}, &block) @app = app @config = Config.new(, &block) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
7 8 9 |
# File 'lib/rack/lti/middleware.rb', line 7 def app @app end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/rack/lti/middleware.rb', line 7 def config @config end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/lti/middleware.rb', line 14 def call(env) request = Rack::Request.new(env) if routes.has_key?(request.path) env['rack.lti'] = true send(routes[request.path], request, env) else @app.call(env) end end |
#routes ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rack/lti/middleware.rb', line 25 def routes { @config.config_path => :config_action, @config.launch_path => :launch_action } end |