class Racknga::LogEntry
Constants
- ATTRIBUTES
Public Class Methods
new(options=nil)
click to toggle source
# File lib/racknga/log_entry.rb, line 35 def initialize(options=nil) options ||= {} @remote_address = options[:remote_address] @remote_user = normalize_string_value(options[:remote_user]) @time_local = options[:time_local] || Time.at(0) @runtime = normalize_float_value(options[:runtime]) @request_time = normalize_float_value(options[:request_time]) @request = options[:request] @status = options[:status] @body_bytes_sent = normalize_int_value(options[:body_bytes_sent]) @http_referer = normalize_string_value(options[:http_referer]) @http_user_agent = normalize_string_value(options[:http_user_agent]) end
Public Instance Methods
==(other)
click to toggle source
# File lib/racknga/log_entry.rb, line 55 def ==(other) other.is_a?(self.class) and attributes == other.attributes end
attributes()
click to toggle source
# File lib/racknga/log_entry.rb, line 49 def attributes ATTRIBUTES.collect do |attribute| __send__(attribute) end end
Private Instance Methods
normalize_float_value(value)
click to toggle source
# File lib/racknga/log_entry.rb, line 68 def normalize_float_value(value) if value.nil? value else value.to_f end end
normalize_int_value(value)
click to toggle source
# File lib/racknga/log_entry.rb, line 76 def normalize_int_value(value) if value.nil? or value == "-" nil else value.to_i end end
normalize_string_value(value)
click to toggle source
# File lib/racknga/log_entry.rb, line 60 def normalize_string_value(value) if value.nil? or value == "-" nil else value.to_s end end