Sha256: f373d598a8f054ed81448c15d865333cfc6c932458aa8352430168274e776d04

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

require_relative 'autoload'
require_relative 'settings'

class User
  attr_reader :name, :difficulty, :attempts, :hints

  def initialize(name, difficulty)
    validation(name, difficulty)
    @difficulty = difficulty
    @name = name
    @level = Settings::DIFFICULTY[@difficulty]
    @attempts = { all: @level[:attempts], used: 0 }
    @hints = { all: @level[:hints], used: 0 }
  end

  def validation(name, difficulty)
    Validations.validate_name(name)
    Validations.validate_difficulty(difficulty)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreaker_kirill-1.1.1 lib/codebreaker_kirill/user.rb
codebreaker_kirill-1.1.0 lib/codebreaker_kirill/user.rb