Class: Colors

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeColors

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

#answerObject (readonly)

Returns the value of attribute answer.



2
3
4
# File 'lib/colors.rb', line 2

def answer
  @answer
end

Instance Method Details

#answer_optionsObject



15
16
17
# File 'lib/colors.rb', line 15

def answer_options
  %w(r g b y)
end

#secret_answerObject



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

#shuffleObject



19
20
21
# File 'lib/colors.rb', line 19

def shuffle
  answer_options.shuffle
end