Sha256: 146b102fde7a2808fec513248fc93d0491806b1633eea05c54f62cb49084c03c

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 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
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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