Sha256: 7770f0ae00de2a22d46dd8a1c40da116fa0c76d902d4880948a103c6d7b7cb89

Contents?: true

Size: 539 Bytes

Versions: 1

Compression:

Stored size: 539 Bytes

Contents

module Codebreaker
  class CreateStatService
    def initialize(game)
      @game = game
    end

    def call
      StatsStorage.new.add(stat_data)
    end

    private

    def stat_data
      {
        name: @game.player.name,
        difficulty: @game.difficulty_type,
        attempts_total: @game.attempts_total,
        attempts_used: @game.attempts_total - @game.attempts_left,
        hints_total: @game.hints_total,
        hints_used: @game.hints_total - @game.hints_left,
        created_at: Time.now
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cb-core-0.1.10 lib/codebreaker/create_stat_service.rb