Sha256: e5e8d315b2416f95f5fa7b03b634c90d11c907c74a4983db1a5ebd2fc3b6a6ee

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Codebreaker
  class Difficulty
    attr_reader :name, :attempts, :hints

    NEGATIVE_INTEGER = 0

    def initialize(name:, attempts:, hints:)
      @name = name
      @attempts = attempts
      @hints = hints
    end

    private

    def validate
      raise Errors::ClassValidError unless valid_class?(String, difficulty)
      raise Errors::NegativeIntegerError unless  valid_non_negative_integer?(attempts, NEGATIVE_INTEGER)
      raise Errors::NegativeIntegerError unless  valid_non_negative_integer?(hints, NEGATIVE_INTEGER)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codebreaker_manfly-0.1.2 lib/codebreaker/difficulty.rb