Sha256: 14d90f4a0f70010f3b834f33b4f35d00dcecd0580cacea6cc5c25f8a94a854a2

Contents?: true

Size: 421 Bytes

Versions: 9

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true

module LogAnalyser
  class Pageviews
    InvalidLogEntriesError = Class.new(StandardError)

    def self.for(entries = {})
      new.generate_view_count(entries)
    rescue StandardError
      raise InvalidLogEntriesError
    end

    def generate_view_count(entries)
      entries
        .transform_values(&:size)
        .sort_by(&:last)
        .reverse
        .to_h
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
log-analyser-0.1.3.pre.littleimprovements.20201109113028 lib/pageviews.rb
log-analyser-0.1.3.pre.littleimprovements.20201109103434 lib/pageviews.rb
log-analyser-0.1.3.pre.littleimprovements.20201109101712 lib/pageviews.rb
log-analyser-0.1.3 lib/pageviews.rb
log-analyser-0.1.3.pre.documentation.20201108213613 lib/pageviews.rb
log-analyser-0.1.3.pre.documentation.20201108213409 lib/pageviews.rb
log-analyser-0.1.3.pre.documentation.20201108212148 lib/pageviews.rb
log-analyser-0.1.3.pre.documentation.20201108193310 lib/pageviews.rb
log-analyser-0.1.3.pre.documentation.20201108192110 lib/pageviews.rb