Class: ActionDispatch::Http::Headers

Inherits:
Hash show all
Defined in:
actionpack/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

Methods inherited from Hash

#as_json, #assert_valid_keys, #deep_dup, #deep_merge, #deep_merge!, #diff, #encode_json, #except, #except!, #extract!, #extractable_options?, from_xml, #reverse_merge, #reverse_merge!, #slice, #slice!, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!, #to_param, #to_xml, #with_indifferent_access

Constructor Details

#initialize(*args) ⇒ Headers

Returns a new instance of Headers.



6
7
8
9
10
11
12
13
14
# File 'actionpack/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 'actionpack/lib/action_dispatch/http/headers.rb', line 16

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