Class: Rack::Unscripted
- Inherits:
-
Object
- Object
- Rack::Unscripted
- Defined in:
- lib/version.rb,
lib/rack/unscripted.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, warning_message = nil) ⇒ Unscripted
constructor
A new instance of Unscripted.
Constructor Details
#initialize(app, warning_message = nil) ⇒ Unscripted
Returns a new instance of Unscripted.
3 4 5 6 |
# File 'lib/rack/unscripted.rb', line 3 def initialize(app, = nil) self. = if @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/unscripted.rb', line 8 def call(env) @status, @headers, @response = @app.call(env) if valid_content_type?(@headers['Content-Type']) && valid_status?(@status) @response.each do |response_line| insert_js(response_line) if response_line =~ head_regex insert_html(response_line) if response_line =~ body_regex end end [@status, @headers, @response] end |