Class: Wordle::GuessValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/wordle/guess_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(guess, list, difficult, must_include, must_match) ⇒ GuessValidator

Returns a new instance of GuessValidator.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/wordle/guess_validator.rb', line 5

def initialize(
  guess,
  list,
  difficult,
  must_include,
  must_match
)
  @guess = guess
  @list = list
  @difficult = difficult
  @must_include = must_include
  @must_match = must_match
  @validated = false
end

Instance Method Details

#errorObject



24
25
26
27
28
# File 'lib/wordle/guess_validator.rb', line 24

def error
  validate if !@validated

  @error
end

#invalid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/wordle/guess_validator.rb', line 20

def invalid?
  !error.nil?
end