class CodebreakerGame::DifficultyFactory
Constants
- EASY_NAME
- HARD_NAME
- MEDIUM_NAME
Public Instance Methods
difficulty_by_name(name)
click to toggle source
# File lib/codebreaker_game/entities/difficulty_factory.rb, line 7 def difficulty_by_name(name) case name when EASY_NAME then Difficulty.new(EASY_NAME, 2, 15) when MEDIUM_NAME then Difficulty.new(MEDIUM_NAME, 1, 10) when HARD_NAME then Difficulty.new(HARD_NAME, 1, 5) else raise WrongDifficultyError, 'Wrong difficulty name' end end