Class: JSONRenderer
- Inherits:
-
Object
- Object
- JSONRenderer
- Defined in:
- lib/ruql/renderers/json_renderer.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(quiz, options = {}) ⇒ JSONRenderer
constructor
A new instance of JSONRenderer.
- #render_quiz ⇒ Object
Constructor Details
#initialize(quiz, options = {}) ⇒ JSONRenderer
Returns a new instance of JSONRenderer.
6 7 8 9 10 |
# File 'lib/ruql/renderers/json_renderer.rb', line 6 def initialize(quiz,={}) @output = '' @json_array = [] @quiz = quiz end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
4 5 6 |
# File 'lib/ruql/renderers/json_renderer.rb', line 4 def output @output end |
Instance Method Details
#render_quiz ⇒ Object
12 13 14 |
# File 'lib/ruql/renderers/json_renderer.rb', line 12 def render_quiz @output = @quiz.questions.map {|question| JSON.pretty_generate(question.to_JSON)} end |