Sha256: 9316397e179bddbd9560e603a7a90e8f02ddcbc82168ce2ab5c3f001630bef1d

Contents?: true

Size: 660 Bytes

Versions: 11

Compression:

Stored size: 660 Bytes

Contents

module ActionController
  module Http
    class Headers < ::Hash
      
      def initialize(constructor = {})
         if constructor.is_a?(Hash)
           super()
           update(constructor)
         else
           super(constructor)
         end
       end
      
      def [](header_name)
        if include?(header_name)
          super 
        else
          super(normalize_header(header_name))
        end
      end
      
      
      private
        # Takes an HTTP header name and returns it in the 
        # format 
        def normalize_header(header_name)
          "HTTP_#{header_name.upcase.gsub(/-/, '_')}"
        end
    end
  end
end

Version data entries

11 entries across 11 versions & 5 rubygems

Version Path
radiant-0.7.2 vendor/rails/actionpack/lib/action_controller/headers.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/actionpack/lib/action_controller/headers.rb
vibes-bj-1.2.1 spec/rails_root/vendor/rails/actionpack/lib/action_controller/headers.rb
actionpack-2.1.0 lib/action_controller/headers.rb
actionpack-2.1.1 lib/action_controller/headers.rb
actionpack-2.1.2 lib/action_controller/headers.rb
antfarm-0.3.0 rails/vendor/rails/actionpack/lib/action_controller/headers.rb
antfarm-0.4.0 rails/vendor/rails/actionpack/lib/action_controller/headers.rb
eactionpack-2.1.2 lib/action_controller/headers.rb
radiant-0.7.0 vendor/rails/actionpack/lib/action_controller/headers.rb
radiant-0.7.1 vendor/rails/actionpack/lib/action_controller/headers.rb