Sha256: b47f0d9e8fe50f729af13483d7f796e8e621826a608b36095098ed42d8b5b9e9

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 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)
    @name = name
    @difficulty = Settings::DIFFICULTY[difficulty]
    @attempts = { all: @difficulty[:attempts], used: 0 }
    @hints = { all: @difficulty[:hints], used: 0 }
  end

  def validation(_input)
    Validations.validate_name(name)
    Validations.validate_difficulty(difficulty)
  rescue StandardError => e
    puts e.message
    nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codebreaker_kirill-0.3.0 lib/codebreaker_kirill/user.rb