class AndriiCodebreaker::Difficulty

Attributes

attempts[R]
hints[R]
name[R]

Public Class Methods

new(name) click to toggle source
# File lib/andrii_codebreaker/difficulty.rb, line 9
def initialize(name)
  validate_difficulty(name)
  @name = name
  @hints = DIFFICULTY[name.to_sym][:hints]
  @attempts = DIFFICULTY[name.to_sym][:attempts]
end

Public Instance Methods

validate_difficulty(name) click to toggle source
# File lib/andrii_codebreaker/difficulty.rb, line 16
def validate_difficulty(name)
  return DIFFICULTY[name.to_sym] if DIFFICULTY.keys.include? name.to_sym

  raise ArgumentError
end