Class: One44::Test
- Inherits:
-
Object
- Object
- One44::Test
- Defined in:
- lib/one44-core/test.rb
Instance Attribute Summary collapse
-
#marker ⇒ Object
readonly
Returns the value of attribute marker.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#questions ⇒ Object
readonly
Returns the value of attribute questions.
Instance Method Summary collapse
-
#initialize(output) ⇒ Test
constructor
A new instance of Test.
- #provide(answer, question = 0) ⇒ Object
- #result ⇒ Object
- #start(name, questions) ⇒ Object
Constructor Details
Instance Attribute Details
#marker ⇒ Object (readonly)
Returns the value of attribute marker.
5 6 7 |
# File 'lib/one44-core/test.rb', line 5 def marker @marker end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/one44-core/test.rb', line 5 def output @output end |
#questions ⇒ Object (readonly)
Returns the value of attribute questions.
5 6 7 |
# File 'lib/one44-core/test.rb', line 5 def questions @questions end |
Instance Method Details
#provide(answer, question = 0) ⇒ Object
20 21 22 23 |
# File 'lib/one44-core/test.rb', line 20 def provide(answer, question = 0) @results << @marker.mark(@questions[question], answer) @output.print @results.last end |
#result ⇒ Object
25 26 27 |
# File 'lib/one44-core/test.rb', line 25 def result @output.print @results.correct.size == @questions.size ? 'PASS' : 'FAIL' end |
#start(name, questions) ⇒ Object
14 15 16 17 18 |
# File 'lib/one44-core/test.rb', line 14 def start(name, questions) @questions = questions @welcome.("Welcome to one44 - #{name}") ask_first_question end |