Class: Template
Defined Under Namespace
Classes: OutputBuffer
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, &body) ⇒ Template
constructor
A new instance of Template.
- #inspect ⇒ Object
- #render(ctx = self) ⇒ Object
Constructor Details
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
15 16 17 |
# File 'opal/stdlib/template.rb', line 15 def body @body end |
Class Method Details
.[](name) ⇒ Object
3 4 5 |
# File 'opal/stdlib/template.rb', line 3 def self.[](name) @_cache[name] || @_cache["templates/#{name}"] end |
.[]=(name, instance) ⇒ Object
7 8 9 |
# File 'opal/stdlib/template.rb', line 7 def self.[]=(name, instance) @_cache[name] = instance end |
.paths ⇒ Object
11 12 13 |
# File 'opal/stdlib/template.rb', line 11 def self.paths @_cache.keys end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'opal/stdlib/template.rb', line 22 def inspect "#<Template: '#{@name}'>" end |
#render(ctx = self) ⇒ Object
26 27 28 |
# File 'opal/stdlib/template.rb', line 26 def render(ctx = self) ctx.instance_exec(OutputBuffer.new, &@body) end |