Class: Difficulty

Inherits:
Object
  • Object
show all
Includes:
CodebreakerConstants
Defined in:
lib/modules/difficulty.rb

Constant Summary

Constants included from CodebreakerConstants

CodebreakerConstants::CODE_SIZE, CodebreakerConstants::DIFFICULTY, CodebreakerConstants::DIFFICULTY_SORT, CodebreakerConstants::FILE_NAME, CodebreakerConstants::MINUS, CodebreakerConstants::NUM_RANGE, CodebreakerConstants::PLUS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Difficulty

Returns a new instance of Difficulty.



7
8
9
10
11
12
13
# File 'lib/modules/difficulty.rb', line 7

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

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

Instance Attribute Details

#attemptsObject

Returns the value of attribute attempts.



5
6
7
# File 'lib/modules/difficulty.rb', line 5

def attempts
  @attempts
end

#hintsObject

Returns the value of attribute hints.



5
6
7
# File 'lib/modules/difficulty.rb', line 5

def hints
  @hints
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/modules/difficulty.rb', line 5

def name
  @name
end