class Codebreaker::CreateStatService
Public Class Methods
new(game)
click to toggle source
# File lib/codebreaker/create_stat_service.rb, line 3 def initialize(game) @game = game end
Public Instance Methods
call()
click to toggle source
# File lib/codebreaker/create_stat_service.rb, line 7 def call StatsStorage.new.add(stat_data) end
Private Instance Methods
stat_data()
click to toggle source
# File lib/codebreaker/create_stat_service.rb, line 13 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