Class: Rack::DisableCSSAnimations

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/disable_css_animations.rb,
lib/rack/disable_css_animations/version.rb

Constant Summary collapse

VERSION =
"0.3.0"

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ DisableCSSAnimations

Returns a new instance of DisableCSSAnimations.



5
6
7
# File 'lib/rack/disable_css_animations.rb', line 5

def initialize app
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rack/disable_css_animations.rb', line 9

def call env
  @status, @headers, @body = @app.call(env)
  return [@status, @headers, @body] unless html?

  response = Rack::Response.new([], @status, @headers)
  @body.each do |fragment|
    response.write inject(fragment)
  end
  @body.close if @body.respond_to?(:close)

  response.finish
end