Class: Renderer
- Inherits:
-
Object
- Object
- Renderer
- Defined in:
- lib/ruql/renderer.rb
Constant Summary collapse
- @@render_handlers =
{}
Instance Attribute Summary collapse
-
#quiz ⇒ Object
readonly
Returns the value of attribute quiz.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(quiz) ⇒ Renderer
constructor
A new instance of Renderer.
- #render_quiz! ⇒ Object
Constructor Details
#initialize(quiz) ⇒ Renderer
Returns a new instance of Renderer.
4 5 6 |
# File 'lib/ruql/renderer.rb', line 4 def initialize(quiz) @quiz = quiz end |
Instance Attribute Details
#quiz ⇒ Object (readonly)
Returns the value of attribute quiz.
3 4 5 |
# File 'lib/ruql/renderer.rb', line 3 def quiz @quiz end |
Class Method Details
.render(thing, &block) ⇒ Object
9 10 11 |
# File 'lib/ruql/renderer.rb', line 9 def self.render(thing, &block) @@render_handlers[thing.to_sym] = block end |
.renderer_for(thing) ⇒ Object
12 13 14 |
# File 'lib/ruql/renderer.rb', line 12 def self.renderer_for(thing) @@render_handlers[thing.to_sym] end |
Instance Method Details
#render_quiz! ⇒ Object
16 17 18 |
# File 'lib/ruql/renderer.rb', line 16 def render_quiz! self.instance_eval@@render_handlers[:quiz].call(self.quiz) end |