Class: Reel::Request::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/reel/request/info.rb

Constant Summary collapse

CASE_INSENSITVE_HASH =
Hash.new do |hash, key|
  hash[hash.keys.find {|k| k =~ /#{key}/i}] if key
end
UPGRADE =
'Upgrade'.freeze
WEBSOCKET =
'websocket'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_method, url, http_version, headers) ⇒ Info



11
12
13
14
15
16
# File 'lib/reel/request/info.rb', line 11

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

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers



9
10
11
# File 'lib/reel/request/info.rb', line 9

def headers
  @headers
end

#http_methodObject (readonly)

Returns the value of attribute http_method



9
10
11
# File 'lib/reel/request/info.rb', line 9

def http_method
  @http_method
end

#http_versionObject (readonly)

Returns the value of attribute http_version



9
10
11
# File 'lib/reel/request/info.rb', line 9

def http_version
  @http_version
end

#urlObject (readonly)

Returns the value of attribute url



9
10
11
# File 'lib/reel/request/info.rb', line 9

def url
  @url
end

Instance Method Details

#websocket_request?Boolean



21
22
23
# File 'lib/reel/request/info.rb', line 21

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