Class: NakedRack
- Inherits:
-
Object
- Object
- NakedRack
- Defined in:
- lib/naked_rack.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :display_banner => true, :remove_js => false, :permanent => false }
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ NakedRack
constructor
A new instance of NakedRack.
Constructor Details
#initialize(app, options = {}) ⇒ NakedRack
7 8 9 10 |
# File 'lib/naked_rack.rb', line 7 def initialize(app, ={}) @app = app = .reverse_merge(DEFAULT_OPTIONS) end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/naked_rack.rb', line 12 def call(env) return @app.call(env) unless today_is_naked_css_day? or [:permanent] status, headers, response = @app.call(env) body = '' response.each do |str| body = (str).to_html body = (body).to_html body = (body).to_html if [:remove_js] end headers['Content-Length'] = body.length.to_s [status, headers, body] end |