Sha256: 227a96d95281b26280ab21ac07fd0085cf3e349bcbb6325a21234f6d300ceb58

Contents?: true

Size: 400 Bytes

Versions: 10

Compression:

Stored size: 400 Bytes

Contents

require_relative '../constants'
class Difficulty
  include CodebreakerConstants

  attr_accessor :attempts, :hints, :name

  def initialize(name)
    return unless valid?(name)

    @name = name
    @hints = DIFFICULTY[name.to_sym][:hints]
    @attempts = DIFFICULTY[name.to_sym][:attempts]
  end

  private

  def valid?(name)
    return true if DIFFICULTY.include? name.to_sym

    false
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
codebreaker_karolina-0.1.9 lib/modules/difficulty.rb
codebreaker_karolina-0.1.8 lib/modules/difficulty.rb
codebreaker_karolina-0.1.7 lib/modules/difficulty.rb
codebreaker_karolina-0.1.6 lib/modules/difficulty.rb
codebreaker_karolina-0.1.5 lib/modules/difficulty.rb
codebreaker_karolina-0.1.4 lib/modules/difficulty.rb
codebreaker_karolina-0.1.3 lib/modules/difficulty.rb
codebreaker_karolina-0.1.2 lib/modules/difficulty.rb
codebreaker_karolina-0.1.1 lib/modules/difficulty.rb
codebreaker_karolina-0.1.0 lib/modules/difficulty.rb