Class: NoAnimations

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/decidim/templates/no_animations.rb

Overview

Disables CSS3 and jQuery animations

Instance Method Summary collapse

Constructor Details

#initialize(app, _options = {}) ⇒ NoAnimations

Returns a new instance of NoAnimations.



7
8
9
# File 'lib/generators/decidim/templates/no_animations.rb', line 7

def initialize(app, _options = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/decidim/templates/no_animations.rb', line 11

def call(env)
  @status, @headers, @body = @app.call(env)
  return [@status, @headers, @body] unless html?
  response = Rack::Response.new([], @status, @headers)

  @body.each { |fragment| response.write inject(fragment) }
  @body.close if @body.respond_to?(:close)

  response.finish
end