Class: Colors
- Inherits:
-
Object
- Object
- Colors
- Defined in:
- lib/colors.rb
Instance Attribute Summary collapse
-
#answer ⇒ Object
readonly
Returns the value of attribute answer.
Instance Method Summary collapse
- #answer_options ⇒ Object
-
#initialize ⇒ Colors
constructor
A new instance of Colors.
- #secret_answer ⇒ Object
- #shuffle ⇒ Object
Constructor Details
#initialize ⇒ Colors
Returns a new instance of Colors.
3 4 5 |
# File 'lib/colors.rb', line 3 def initialize @answer = %w(r r r r) end |
Instance Attribute Details
#answer ⇒ Object (readonly)
Returns the value of attribute answer.
2 3 4 |
# File 'lib/colors.rb', line 2 def answer @answer end |
Instance Method Details
#answer_options ⇒ Object
15 16 17 |
# File 'lib/colors.rb', line 15 def %w(r g b y) end |
#secret_answer ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/colors.rb', line 7 def secret_answer @answer = [] 4.times do answer << shuffle.pop end answer end |
#shuffle ⇒ Object
19 20 21 |
# File 'lib/colors.rb', line 19 def shuffle .shuffle end |