Class: ActionDispatch::BestStandardsSupport

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/middleware/best_standards_support.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, type = true) ⇒ BestStandardsSupport

Returns a new instance of BestStandardsSupport.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/action_dispatch/middleware/best_standards_support.rb', line 3

def initialize(app, type = true)
  @app = app

  @header = case type
  when true
    "IE=Edge,chrome=1"
  when :builtin
    "IE=Edge"
  when false
    nil
  end
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/action_dispatch/middleware/best_standards_support.rb', line 16

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

  if headers["X-UA-Compatible"] && @header
    unless headers["X-UA-Compatible"][@header]
      headers["X-UA-Compatible"] << "," << @header.to_s
    end
  else
    headers["X-UA-Compatible"] = @header
  end

  [status, headers, body]
end