Class: ActionDispatch::Http::Headers

Inherits:
Hash
  • Object
show all
Defined in:
lib/action_dispatch/http/headers.rb

Constant Summary collapse

@@env_cache =
Hash.new { |h,k| h[k] = "HTTP_#{k.upcase.gsub(/-/, '_')}" }

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Headers

Returns a new instance of Headers.



6
7
8
9
10
11
12
13
14
# File 'lib/action_dispatch/http/headers.rb', line 6

def initialize(*args)

  if args.size == 1 && args[0].is_a?(Hash)
    super()
    update(args[0])
  else
    super
  end
end

Instance Method Details

#[](header_name) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/action_dispatch/http/headers.rb', line 16

def [](header_name)
  if include?(header_name)
    super
  else
    super(env_name(header_name))
  end
end