### Home Classes Methods

### In Files

- lib/rack/utils.rb

### Parent

Hash

### Methods

- ::new
- ::new
- #[]
- #[]=
- #delete
- #each
- #has_key?
- #include?
- #key?
- #member?
- #merge
- #merge!
- #replace
- #to_hash

### Files

- KNOWN-ISSUES

### Class/Module Index

Quicksearch

- Rack
- Rack::Auth
- Rack::Auth::AbstractHandler
- Rack::Auth::AbstractRequest
- Rack::Auth::Basic
- Rack::Auth::Basic::Request
- Rack::Auth::Digest
- Rack::Auth::Digest::MD5
- Rack::Auth::Digest::Nonce
- Rack::Auth::Digest::Params
- Rack::Auth::Digest::Request
- Rack::BodyProxy
- Rack::Builder
- Rack::Cascade
- Rack::Chunked
- Rack::Chunked::Body
- Rack::CommonLogger
- Rack::ConditionalGet
- Rack::Config
- Rack::ContentLength
- Rack::ContentType
- Rack::Deflater
- Rack::Deflater::DeflateStream
- Rack::Deflater::GzipStream
- Rack::Directory
- Rack::ETag
- Rack::File
- Rack::ForwardRequest
- Rack::Handler
- Rack::Handler::CGI
- Rack::Handler::EventedMongrel
- Rack::Handler::FastCGI
- Rack::Handler::LSWS
- Rack::Handler::Mongrel
- Rack::Handler::SCGI
- Rack::Handler::SwiftipliedMongrel
- Rack::Handler::Thin
- Rack::Handler::WEBrick
- Rack::Head
- Rack::Lint
- Rack::Lobster
- Rack::Lock
- Rack::Logger
- Rack::MethodOverride
- Rack::Mime
- Rack::MockRequest
- Rack::MockRequest::FatalWarner
- Rack::MockRequest::FatalWarning
- Rack::MockResponse
- Rack::Multipart
- Rack::Multipart::Generator
- Rack::Multipart::MultipartPartLimitError
- Rack::Multipart::Parser
- Rack::Multipart::UploadedFile
- Rack::NullLogger
- Rack::Recursive
- Rack::Reloader
- Rack::Reloader::Stat
- Rack::Request
- Rack::Response
- Rack::Response::Helpers
- Rack::RewindableInput
- Rack::RewindableInput::Tempfile
- Rack::Runtime
- Rack::Sendfile
- Rack::Server
- Rack::Server::Options
- Rack::Session
- Rack::Session::Abstract
- Rack::Session::Abstract::ID
- Rack::Session::Abstract::SessionHash
- Rack::Session::Cookie
- Rack::Session::Cookie::Base64
- Rack::Session::Cookie::Base64::JSON
- Rack::Session::Cookie::Base64::Marshal
- Rack::Session::Cookie::Base64::ZipJSON
- Rack::Session::Cookie::Identity
- Rack::Session::Memcache
- Rack::Session::Pool
- Rack::ShowExceptions
- Rack::ShowStatus
- Rack::Static
- Rack::TempfileReaper
- Rack::URLMap
- Rack::Utils
- Rack::Utils::Context
- Rack::Utils::HeaderHash
- Rack::Utils::InvalidParameterError
- Rack::Utils::KeySpaceConstrainedParams
- Rack::Utils::Multipart
- Rack::Utils::OkJson
- Rack::Utils::OkJson::Error
- Rack::Utils::OkJson::Utf8Error
- Rack::Utils::ParameterTypeError
- FCGI
- FCGI::Stream
- WEBrick
- WEBrick::HTTPResponse
- Object

No matching classes.

# Rack::Utils::HeaderHash

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

### Public Class Methods

new(hash={}) click to toggle source

    # File lib/rack/utils.rb, line 477
    def self.new(hash={})
      HeaderHash === hash ? hash : super(hash)
    end

new(hash={}) click to toggle source

    # File lib/rack/utils.rb, line 481
    def initialize(hash={})
      super()
      @names = {}
      hash.each { |k, v| self[k] = v }
    end

### Public Instance Methods

[](k) click to toggle source

    # File lib/rack/utils.rb, line 499
    def [](k)
      super(k) || super(@names[k.downcase])
    end

[]=(k, v) click to toggle source

    # File lib/rack/utils.rb, line 503
    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

delete(k) click to toggle source

    # File lib/rack/utils.rb, line 510
    def delete(k)
      canonical = k.downcase
      result = super @names.delete(canonical)
      @names.delete_if { |name,| name.downcase == canonical }
      result
    end

each() click to toggle source

    # File lib/rack/utils.rb, line 487
    def each
      super do |k, v|
        yield(k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v)
      end
    end

has_key?(k) click to toggle source
Alias for: include?
include?(k) click to toggle source

    # File lib/rack/utils.rb, line 517
    def include?(k)
      @names.include?(k) || @names.include?(k.downcase)
    end

Also aliased as: has_key?, member?, key?
key?(k) click to toggle source
Alias for: include?
member?(k) click to toggle source
Alias for: include?
merge(other) click to toggle source

    # File lib/rack/utils.rb, line 530
    def merge(other)
      hash = dup
      hash.merge! other
    end

merge!(other) click to toggle source

    # File lib/rack/utils.rb, line 525
    def merge!(other)
      other.each { |k, v| self[k] = v }
      self
    end

replace(other) click to toggle source

    # File lib/rack/utils.rb, line 535
    def replace(other)
      clear
      other.each { |k, v| self[k] = v }
      self
    end

to_hash() click to toggle source

    # File lib/rack/utils.rb, line 493
    def to_hash
      hash = {}
      each { |k,v| hash[k] = v }
      hash
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.