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