Class: HTTPLogAnalyzer::Element::Request

Inherits:
HTTPLogAnalyzer::Element show all
Defined in:
lib/http-log-analyzer/element/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HTTPLogAnalyzer::Element

#normalize_uri!, parse

Instance Attribute Details

#mime_typesObject

Returns the value of attribute mime_types.



8
9
10
# File 'lib/http-log-analyzer/element/request.rb', line 8

def mime_types
  @mime_types
end

#uriObject

Returns the value of attribute uri.



7
8
9
# File 'lib/http-log-analyzer/element/request.rb', line 7

def uri
  @uri
end

Instance Method Details

#parse(string) ⇒ Object



10
11
12
13
14
15
# File 'lib/http-log-analyzer/element/request.rb', line 10

def parse(string)
  @method, uri_string, @version = string.split(/\s+/)
  @uri = Addressable::URI.parse(uri_string) or raise ParseError, "Can't parse URI: #{uri_string}"
  normalize_uri!(@uri)
  @mime_types = MIME::Types.type_for(@uri.path)
end