Class: Kronk::Player::RequestParser

Inherits:
Object
  • Object
show all
Defined in:
lib/kronk/player/request_parser.rb

Overview

Stream-friendly HTTP Request parser for piping into the Kronk player. Uses Kronk::Request for parsing.

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ Object

Parse a single http request kronk options hash. See Kronk::Request.parse for more about request parsing.



23
24
25
# File 'lib/kronk/player/request_parser.rb', line 23

def self.parse string
  Kronk::Request.parse_to_hash string
end

.start_new?(line) ⇒ Boolean

Returns true if the line given is the start of a new request.

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/kronk/player/request_parser.rb', line 12

def self.start_new? line
  line =~ Request::REQUEST_LINE_MATCHER
  # Make sure we have a host ($2) or path ($3 || $4) before proceeding.
  !!($2 || $3 || $4)
end