Class: ActionDispatch::Response::Header

Inherits:
Hash show all
Defined in:
actionpack/lib/action_dispatch/http/response.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Hash

#as_json, #assert_valid_keys, #compact, #compact!, #deep_dup, #deep_merge, #deep_merge!, #deep_stringify_keys, #deep_stringify_keys!, #deep_symbolize_keys, #deep_symbolize_keys!, #deep_transform_keys, #deep_transform_keys!, #except, #except!, #extract!, #extractable_options?, from_trusted_xml, from_xml, #reverse_merge, #reverse_merge!, #slice, #slice!, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!, #to_query, #to_xml, #transform_keys, #transform_keys!, #transform_values, #transform_values!, #with_indifferent_access

Constructor Details

#initialize(response, header) ⇒ Header

Returns a new instance of Header.


37
38
39
40
# File 'actionpack/lib/action_dispatch/http/response.rb', line 37

def initialize(response, header)
  @response = response
  super(header)
end

Instance Method Details

#[]=(k, v) ⇒ Object


42
43
44
45
46
47
48
# File 'actionpack/lib/action_dispatch/http/response.rb', line 42

def []=(k,v)
  if @response.sending? || @response.sent?
    raise ActionDispatch::IllegalStateError, 'header already sent'
  end

  super
end

#merge(other) ⇒ Object


50
51
52
# File 'actionpack/lib/action_dispatch/http/response.rb', line 50

def merge(other)
  self.class.new @response, __getobj__.merge(other)
end

#to_hashObject


54
55
56
# File 'actionpack/lib/action_dispatch/http/response.rb', line 54

def to_hash
  __getobj__.dup
end