Class: Haproxy2Rpm::LineParser
- Inherits:
-
Object
- Object
- Haproxy2Rpm::LineParser
- Defined in:
- lib/haproxy2rpm/line_parser.rb
Instance Method Summary collapse
-
#http_method ⇒ Object
we need to chop ".
- #http_path ⇒ Object
- #http_query ⇒ Object
-
#initialize(line) ⇒ LineParser
constructor
A new instance of LineParser.
- #is_error? ⇒ Boolean
- #status_code ⇒ Object
- #tc ⇒ Object
- #tq ⇒ Object
- #tr ⇒ Object
- #tt ⇒ Object
- #tw ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(line) ⇒ LineParser
Returns a new instance of LineParser.
4 5 6 |
# File 'lib/haproxy2rpm/line_parser.rb', line 4 def initialize(line) @parts = line.split("\s") end |
Instance Method Details
#http_method ⇒ Object
we need to chop "
33 34 35 |
# File 'lib/haproxy2rpm/line_parser.rb', line 33 def http_method @http_method ||= @parts[12][1..-1] end |
#http_path ⇒ Object
41 42 43 |
# File 'lib/haproxy2rpm/line_parser.rb', line 41 def http_path uri.path end |
#http_query ⇒ Object
45 46 47 |
# File 'lib/haproxy2rpm/line_parser.rb', line 45 def http_query uri.query end |
#is_error? ⇒ Boolean
49 50 51 |
# File 'lib/haproxy2rpm/line_parser.rb', line 49 def is_error? status_code >= 500 end |
#status_code ⇒ Object
28 29 30 |
# File 'lib/haproxy2rpm/line_parser.rb', line 28 def status_code @status_code ||= @parts[5].to_i end |
#tc ⇒ Object
16 17 18 |
# File 'lib/haproxy2rpm/line_parser.rb', line 16 def tc @tc ||= response_times[2].to_i end |
#tq ⇒ Object
8 9 10 |
# File 'lib/haproxy2rpm/line_parser.rb', line 8 def tq @tw ||= response_times[0].to_i end |
#tr ⇒ Object
20 21 22 |
# File 'lib/haproxy2rpm/line_parser.rb', line 20 def tr @tr ||= response_times[3].to_i end |
#tt ⇒ Object
24 25 26 |
# File 'lib/haproxy2rpm/line_parser.rb', line 24 def tt @tt ||= response_times[4].to_i end |
#tw ⇒ Object
12 13 14 |
# File 'lib/haproxy2rpm/line_parser.rb', line 12 def tw @tw ||= response_times[1].to_i end |
#uri ⇒ Object
37 38 39 |
# File 'lib/haproxy2rpm/line_parser.rb', line 37 def uri @uri ||= URI.parse(@parts[13]) end |