Sha256: 7709be70b15d898b3ee3c5cba3d1a4f4f9f41ef471202734433c5679d74cd911

Contents?: true

Size: 535 Bytes

Versions: 2

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true

module Codebreaker
  class Difficulty < BaseClass
    LEVELS = {
      easy: { attempts: 15, hints: 3, name: 'easy', id: 1 },
      medium: { attempts: 10, hints: 2, name: 'medium', id: 2 },
      hell: { attempts: 5, hints: 1, name: 'hell', id: 3 }
    }.freeze

    attr_reader :errors, :level

    def initialize(level = :easy)
      @level = LEVELS[level.to_sym]
      @errors = []
    end

    def validate
      @errors << 'unexpected_comand' unless LEVELS.values.include? @level
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreaker_gapdn-0.1.5 lib/entities/difficulty.rb
codebreaker_gapdn-0.1.3 lib/entities/difficulty.rb