Class: Barker::Quiz

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(questions) ⇒ Quiz

Returns a new instance of Quiz.



6
7
8
# File 'lib/barker/quiz.rb', line 6

def initialize(questions)
  @questions = questions
end

Instance Attribute Details

#questionsObject (readonly)

Returns the value of attribute questions.



4
5
6
# File 'lib/barker/quiz.rb', line 4

def questions
  @questions
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/barker/quiz.rb', line 14

def ==(other)
  questions == other.questions
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/barker/quiz.rb', line 10

def valid?
  questions.all?(&:valid?)
end