Sha256: 3d7a89fcdb0a6e8a2c7ebad1c4f2c69f99eb9c3d8730017f21965d585cb5b0e5

Contents?: true

Size: 330 Bytes

Versions: 3

Compression:

Stored size: 330 Bytes

Contents

class Difficult
  attr_reader :level

  def initialize(level)
    @level = level.downcase
  end

  def to_i
    case @level
    when name('hell') then 1
    when name('medium') then 2
    when name('easy') then 3
    end
  end

  private

  def name(difficult)
    Codebreaker::Game::DIFFICULTS[difficult.to_sym][:name]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
codebreaker_dmitriev-0.2.2 lib/console_app/difficult.rb
codebreaker_dmitriev-0.2.1 lib/console_app/difficult.rb
codebreaker_dmitriev-0.2.0 lib/console_app/difficult.rb