Class: ActionDispatch::Response::Header

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(response, header) ⇒ Header

Returns a new instance of Header.



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

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

Instance Method Details

#[]=(k, v) ⇒ Object



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

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

  super
end

#merge(other) ⇒ Object



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

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

#to_hashObject



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

def to_hash
  __getobj__.dup
end