Sha256: 17b62a6f399109cbbbc6c0579550c5d376453271fdea346cf81a2bbe7a7e0c0d

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

Stored size: 474 Bytes

Contents

module Codebreaker
  class DifficultyFactory
    def self.build(type)
      case type
      when DifficultyType::EASY
        Difficulty.new(DifficultyType::EASY, 15, 2)
      when DifficultyType::MEDIUM
        Difficulty.new(DifficultyType::MEDIUM, 10, 1)
      when DifficultyType::HELL
        Difficulty.new(DifficultyType::HELL, 5, 1)
      else
        raise Errors::InvalidDifficultyError, I18n.t('errors.invalid_difficulty', type: type)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cb-core-0.1.8 lib/codebreaker/difficulty_factory.rb
cb-core-0.1.7 lib/codebreaker/difficulty_factory.rb