Class: Wordle::ResultBuilder
- Inherits:
-
Object
- Object
- Wordle::ResultBuilder
- Defined in:
- lib/wordle/result_builder.rb
Constant Summary collapse
- MATCH =
:match- INCLUDED =
:included- MISS =
:miss- DEFAULT_OPTIONS =
{ MATCH => {text: :green, square: "🟩"}, INCLUDED => {text: :yellow, square: "🟨"}, MISS => {text: :gray, square: "⬛️"} }.freeze
- CONTRAST_OPTIONS =
{ MATCH => {text: :orange, square: "🟧"}, INCLUDED => {text: :blue, square: "🟦"}, MISS => {text: :gray, square: "⬛️"} }.freeze
Instance Method Summary collapse
- #included ⇒ Object
- #included?(result) ⇒ Boolean
- #included_text_color ⇒ Object
-
#initialize(contrast = false) ⇒ ResultBuilder
constructor
A new instance of ResultBuilder.
- #match ⇒ Object
- #match?(result) ⇒ Boolean
- #match_text_color ⇒ Object
- #miss ⇒ Object
- #square(result) ⇒ Object
- #text_color(result) ⇒ Object
Constructor Details
#initialize(contrast = false) ⇒ ResultBuilder
Returns a new instance of ResultBuilder.
21 22 23 |
# File 'lib/wordle/result_builder.rb', line 21 def initialize(contrast = false) @contrast = contrast end |
Instance Method Details
#included ⇒ Object
37 38 39 |
# File 'lib/wordle/result_builder.rb', line 37 def included INCLUDED end |
#included?(result) ⇒ Boolean
29 30 31 |
# File 'lib/wordle/result_builder.rb', line 29 def included?(result) result == INCLUDED end |
#included_text_color ⇒ Object
49 50 51 |
# File 'lib/wordle/result_builder.rb', line 49 def included_text_color [included][:text] end |
#match ⇒ Object
33 34 35 |
# File 'lib/wordle/result_builder.rb', line 33 def match MATCH end |
#match?(result) ⇒ Boolean
25 26 27 |
# File 'lib/wordle/result_builder.rb', line 25 def match?(result) result == MATCH end |
#match_text_color ⇒ Object
45 46 47 |
# File 'lib/wordle/result_builder.rb', line 45 def match_text_color [match][:text] end |
#miss ⇒ Object
41 42 43 |
# File 'lib/wordle/result_builder.rb', line 41 def miss MISS end |
#square(result) ⇒ Object
57 58 59 |
# File 'lib/wordle/result_builder.rb', line 57 def square(result) [result][:square] end |
#text_color(result) ⇒ Object
53 54 55 |
# File 'lib/wordle/result_builder.rb', line 53 def text_color(result) [result][:text] end |