Class: ReactiveTemplate
- Includes:
- Events
- Defined in:
- lib/volt/page/reactive_template.rb
Instance Method Summary collapse
-
#cur ⇒ Object
Render the template and get the current value.
-
#initialize(page, context, template_path) ⇒ ReactiveTemplate
constructor
A new instance of ReactiveTemplate.
- #reactive? ⇒ Boolean
- #remove ⇒ Object
- #update ⇒ Object
Methods included from Events
#event_chain, #has_listeners?, #listeners, #on, #remove_listener, #trigger!, #trigger_by_scope!, #trigger_for_methods!
Constructor Details
#initialize(page, context, template_path) ⇒ ReactiveTemplate
Returns a new instance of ReactiveTemplate.
4 5 6 7 8 9 |
# File 'lib/volt/page/reactive_template.rb', line 4 def initialize(page, context, template_path) @template_path = template_path @target = AttributeTarget.new(nil, nil, self) @template = TemplateRenderer.new(page, @target, context, "main", template_path) end |
Instance Method Details
#cur ⇒ Object
Render the template and get the current value
16 17 18 |
# File 'lib/volt/page/reactive_template.rb', line 16 def cur @target.to_html end |
#reactive? ⇒ Boolean
11 12 13 |
# File 'lib/volt/page/reactive_template.rb', line 11 def reactive? true end |
#remove ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/volt/page/reactive_template.rb', line 24 def remove @template.remove @template = nil @target = nil @template_path = nil end |
#update ⇒ Object
20 21 22 |
# File 'lib/volt/page/reactive_template.rb', line 20 def update trigger!('changed') end |