Class: Rack::NoAnimations

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/no_animations.rb

Constant Summary collapse

TEXT_HTML =
%r{text/html}.freeze
CONTENT_LENGTH =
'Content-Length'.freeze
DISABLE_ANIMATIONS_SNIPPET =
<<-EOF
<scrip>if (typeof jQuery !== 'undefined') { jQuery.fx.off = true }</script>
<style>
* {
   -o-transition: none !important;
   -moz-transition: none !important;
   -ms-transition: none !important;
   -webkit-transition: none !important;
   transition: none !important;
   -o-transform: none !important;
   -moz-transform: none !important;
   -ms-transform: none !important;
   -webkit-transform: none !important;
   transform: none !important;
   -webkit-animation: none !important;
   -moz-animation: none !important;
   -o-animation: none !important;
   -ms-animation: none !important;
   animation: none !important;
}
</style>
EOF
SNIPPET_LENGTH =
DISABLE_ANIMATIONS_SNIPPET.length

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ NoAnimations

Returns a new instance of NoAnimations.



30
31
32
# File 'lib/rack/no_animations.rb', line 30

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/rack/no_animations.rb', line 34

def call(env)
  status, headers, body = env = @app.call(env)

  return env unless is_html?(headers)

  response(status, headers, body)
end