Class: Rack::DenyIE

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

Constant Summary collapse

URL_REGEX =
%r{\b(([\w-]+://?|[\w\d]+[.])[^\s()<>]+(?:(?:\([\w\d)]+\)[^\s()<>]*)+|([^[:punct:]\s]|/)))}
DEFAULT_MIN_VERSION =

Default Options

7
DEFAULT_HEADLINE =
"This version of Internet Explorer is not supported."
DEFAULT_SITE =
"this site"
DEFAULT_TEMPLATE_PATH =
::File.join(::File.dirname(__FILE__), 'html', 'default.erb')
DEFAULT_REDIRECT_MESSAGE =
"Your browser is unsupported."

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ DenyIE

Returns a new instance of DenyIE.



18
19
20
21
22
23
24
25
26
# File 'lib/rack-denyie.rb', line 18

def initialize(app, options = {})
  @app = app
  @options = { 
    :min_version => DEFAULT_MIN_VERSION, # The minimum version of IE you want allowed through
    :headline => DEFAULT_HEADLINE, # The headline message displayed to filtered IE users
    :site_name => DEFAULT_SITE, # Your site name.
    :template => DEFAULT_TEMPLATE_PATH, # A custom template, either ERB or HTML
    :redirect_url => nil }.merge options # Redirects users to a new location rather than displaying a template
end

Instance Method Details

#call(env) ⇒ Object



28
29
30
31
# File 'lib/rack-denyie.rb', line 28

def call(env)
  status, @headers, content = @app.call(env)
  is_unsupported?(env) && is_content_html? ? act_on_ie : @app.call(env)
end