Class: Ruql::Json
- Inherits:
-
Object
- Object
- Ruql::Json
- Defined in:
- lib/ruql/json.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(quiz, options = {}) ⇒ Json
constructor
A new instance of Json.
- #render_quiz ⇒ Object
Constructor Details
#initialize(quiz, options = {}) ⇒ Json
Returns a new instance of Json.
4 5 6 7 |
# File 'lib/ruql/json.rb', line 4 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/json.rb', line 3 def output @output end |
Instance Method Details
#render_quiz ⇒ Object
8 9 10 |
# File 'lib/ruql/json.rb', line 8 def render_quiz @output = JSON.pretty_generate(@quiz.as_json) end |