Class: HamlInterceptor
- Inherits:
-
Object
- Object
- HamlInterceptor
- Defined in:
- lib/haml_interceptor.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ HamlInterceptor
constructor
A new instance of HamlInterceptor.
Constructor Details
#initialize(app, opts = {}) ⇒ HamlInterceptor
Returns a new instance of HamlInterceptor.
4 5 6 |
# File 'lib/haml_interceptor.rb', line 4 def initialize(app, opts={}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/haml_interceptor.rb', line 8 def call(env) status, headers, body = @app.call(env) if headers.has_key?('Content-Type') && headers['Content-Type'] =~ /javascript/ body = Haml::HTML.new(body.body.join).render end [status, headers, body] end |