class HTTPLogAnalyzer::Entry

Attributes

referer[RW]
request[RW]
source[RW]
status[RW]
timestamp[RW]
user_agent[RW]

Public Class Methods

new(info) click to toggle source
# File lib/http-log-analyzer/entry.rb, line 12
def initialize(info)
  # 12/Feb/2016:09:59:04 +0000
  @timestamp = DateTime.strptime(info[:datetime], '%d/%b/%Y:%H:%M:%S %Z')
  @source = Element::Source.parse(info[:ip])
  @request = Element::Request.parse(info[:request])
  @status = Element::Status.parse(info[:status])
  @referer = Element::Referer.parse(info[:referer])
  @user_agent = Element::UserAgent.parse(info[:user_agent])
end

Public Instance Methods

calendar_week() click to toggle source
# File lib/http-log-analyzer/entry.rb, line 22
def calendar_week
  '%s - %s' % [1, 7].map { |d| DateTime.commercial(@timestamp.year, @timestamp.cweek, d).to_date }
end