Class: Rack::DenyIE
- Inherits:
-
Object
- Object
- Rack::DenyIE
- 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
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ DenyIE
constructor
A new instance of DenyIE.
Constructor Details
#initialize(app, options = {}) ⇒ DenyIE
Returns a new instance of DenyIE.
16 17 18 19 20 21 22 23 24 |
# File 'lib/rack-denyie.rb', line 16 def initialize(app, = {}) @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 # Redirects users to a new location rather than displaying a template end |
Instance Method Details
#call(env) ⇒ Object
26 27 28 29 |
# File 'lib/rack-denyie.rb', line 26 def call(env) status, @headers, content = @app.call(env) is_unsupported?(env) && is_content_html? ? act_on_ie : [status, @headers, content] end |