Class: Ruql::Stats
- Inherits:
-
Object
- Object
- Ruql::Stats
- Defined in:
- lib/ruql/stats.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#quiz ⇒ Object
readonly
Returns the value of attribute quiz.
Instance Method Summary collapse
-
#initialize(quiz, options = {}) ⇒ Stats
constructor
a pseudo-renderer that just prints stats about the quiz.
- #render_quiz ⇒ Object
Constructor Details
#initialize(quiz, options = {}) ⇒ Stats
a pseudo-renderer that just prints stats about the quiz
5 6 7 8 |
# File 'lib/ruql/stats.rb', line 5 def initialize(quiz, ={}) @quiz = quiz @output = [] end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
3 4 5 |
# File 'lib/ruql/stats.rb', line 3 def output @output end |
#quiz ⇒ Object (readonly)
Returns the value of attribute quiz.
3 4 5 |
# File 'lib/ruql/stats.rb', line 3 def quiz @quiz end |
Instance Method Details
#render_quiz ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/ruql/stats.rb', line 9 def render_quiz @output << "%3d questions" % quiz.questions.length @output << " %3d (%d points) in no group" % [quiz.ungrouped_questions.length, quiz.ungrouped_points] @output << " %3d (%d points) in %d groups" % [quiz.grouped_questions.length, quiz.grouped_points, quiz.groups.length] @output << "%3d effective questions on quiz" % quiz.num_questions @output << "%3d max points possible" % quiz.points @output.join("\n") end |