Sha256: 2243ab49acab0c7824ad1362a64ddd960d283faa7824cd473bfe4f3a6257704d

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

module Reel
  class Request
    class Info

      CASE_INSENSITVE_HASH = Hash.new do |hash, key|
        hash[hash.keys.find {|k| k =~ /#{key}/i}] if key
      end

      attr_reader :http_method, :url, :http_version, :headers

      def initialize(http_method, url, http_version, headers)
        @http_method  = http_method
        @url          = url
        @http_version = http_version
        @headers      = CASE_INSENSITVE_HASH.merge headers
      end

      UPGRADE   = 'Upgrade'.freeze
      WEBSOCKET = 'websocket'.freeze

      def websocket_request?
        headers[UPGRADE] && headers[UPGRADE].downcase == WEBSOCKET
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reel-0.6.1 lib/reel/request/info.rb
reel-0.6.0 lib/reel/request/info.rb
reel-0.6.0.pre5 lib/reel/request/info.rb
reel-0.6.0.pre4 lib/reel/request/info.rb
reel-0.6.0.pre3 lib/reel/request/info.rb
reel-0.6.0.pre2 lib/reel/request/info.rb
reel-0.6.0.pre1 lib/reel/request/info.rb