class Puma::Util::HeaderHash

header when set.
A case-insensitive Hash that preserves the original case of a

def self.new(hash={})

def self.new(hash={})
  HeaderHash === hash ? hash : super(hash)
end

def [](k)

def [](k)
  super(k) || super(@names[k.downcase])
end

def []=(k, v)

def []=(k, v)
  canonical = k.downcase
  delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
  @names[k] = @names[canonical] = k
  super k, v
end

def delete(k)

def delete(k)
  canonical = k.downcase
  result = super @names.delete(canonical)
  @names.delete_if { |name,| name.downcase == canonical }
  result
end

def each

def each
  super do |k, v|
    yield(k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v)
  end
end

def include?(k)

def include?(k)
  @names.include?(k) || @names.include?(k.downcase)
end

def initialize(hash={})

def initialize(hash={})
  super()
  @names = {}
  hash.each { |k, v| self[k] = v }
end

def merge(other)

def merge(other)
  hash = dup
  hash.merge! other
end

def merge!(other)

def merge!(other)
  other.each { |k, v| self[k] = v }
  self
end

def replace(other)

def replace(other)
  clear
  other.each { |k, v| self[k] = v }
  self
end

def to_hash

@!attribute [r] to_hash
def to_hash
  hash = {}
  each { |k,v| hash[k] = v }
  hash
end