Method: HTTP::Protocol::Headers#delete

Defined in:
lib/http/protocol/headers.rb

#delete(key) ⇒ Object

Delete all headers with the given key, and return the value of the last one, if any.



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/http/protocol/headers.rb', line 84

def delete(key)
  values, @fields = @fields.partition do |field|
    field.first.downcase == key
  end
  
  if @indexed
    @indexed.delete(key)
  end
  
  if field = values.last
    return field.last
  end
end