Class: ActionController::Live::Response::Header

Inherits:
Hash
  • Object
show all
Defined in:
lib/action_controller/metal/live.rb

Instance Method Summary collapse

Constructor Details

#initialize(response, header) ⇒ Header

Returns a new instance of Header.



72
73
74
75
# File 'lib/action_controller/metal/live.rb', line 72

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

Instance Method Details

#[]=(k, v) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/action_controller/metal/live.rb', line 77

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

  super
end

#merge(other) ⇒ Object



85
86
87
# File 'lib/action_controller/metal/live.rb', line 85

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

#to_hashObject



89
90
91
# File 'lib/action_controller/metal/live.rb', line 89

def to_hash
  __getobj__.dup
end