lib/simple_log_counter/parser.rb
def visitor_counter(log)
        counter = Hash.new { |h, k| h[k] = 0 }
        log.each_line
           .each_with_object(counter) { |line, hsh| hsh[page_from_line(line)] += 1 }
      end
# Parses web log file to dicionary of page counts.
#
# Algorithm centres around a reduction operation, so time complexity =
# O(n)
Parses web log file to dicionary of page counts.
Algorithm centres around a reduction operation, so time complexity
O(n)
Parses web log file to dicionary of page counts . Algorithm centres around a reduction operation so time complexity O ( n )
def visitor_counter(log)
        counter = Hash.new { |h, k| h[k] = 0 }
        log.each_line
           .each_with_object(counter) { |line, hsh| hsh[page_from_line(line)] += 1 }
      end
def visitor_counter ( log ) counter = Hash . new { | h , k | h [ k ] = 0 } log . each_line . each_with_object ( counter ) { | line , hsh | hsh [ page_from_line ( line ) ] += 1 } end
Parses web log file to dicionary of page counts.
Parses web log file to dicionary of page counts .
log