Class: Rack::Relations::Middleware
- Inherits:
-
Object
- Object
- Rack::Relations::Middleware
- Defined in:
- lib/rack/relations/middleware.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#processor ⇒ Object
Returns the value of attribute processor.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, safelist_domains: []) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, safelist_domains: []) ⇒ Middleware
Returns a new instance of Middleware.
6 7 8 9 |
# File 'lib/rack/relations/middleware.rb', line 6 def initialize(app, safelist_domains: []) @app = app @processor = Rack::Relations::Processor.new(safelist_domains: safelist_domains) end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
4 5 6 |
# File 'lib/rack/relations/middleware.rb', line 4 def app @app end |
#processor ⇒ Object
Returns the value of attribute processor.
4 5 6 |
# File 'lib/rack/relations/middleware.rb', line 4 def processor @processor end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rack/relations/middleware.rb', line 11 def call(env) status, headers, response = @app.call(env) response = @processor.perform(response) if headers["Content-Type"].to_s.include?("text/html") [status, headers, response] end |