class NginxTop::Request

Constants

DIRECTIVES
REGEX

Public Class Methods

new(log) click to toggle source
# File lib/nginxtop/request.rb, line 7
def initialize(log)
  @log = log
  log.scan(REGEX).flatten.each_with_index do |value, index|
    instance_variable_set "@#{DIRECTIVES[index]}".to_sym, value
  end
end

Public Instance Methods

status_verb() click to toggle source
# File lib/nginxtop/request.rb, line 14
def status_verb
  status = http_status.to_i
  if status.between?(200, 299)
    :success
  elsif status.between?(300, 399)
    :redirection
  elsif status.between?(400, 499)
    :client_error
  elsif status.between?(500, 599)
    :server_error
  else
    :unknown
  end
end