Class: Txbr::Template
- Inherits:
-
Object
- Object
- Txbr::Template
- Defined in:
- lib/txbr/template.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#liquid_template ⇒ Object
readonly
Returns the value of attribute liquid_template.
Instance Method Summary collapse
- #each_content_tag ⇒ Object
-
#initialize(id, source, prerender_variables = {}) ⇒ Template
constructor
A new instance of Template.
- #render ⇒ Object
- #root ⇒ Object
Constructor Details
#initialize(id, source, prerender_variables = {}) ⇒ Template
Returns a new instance of Template.
5 6 7 8 9 10 11 |
# File 'lib/txbr/template.rb', line 5 def initialize(id, source, prerender_variables = {}) @id = id @liquid_template = ::Liquid::Template.parse( prerender(source, prerender_variables) ) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/txbr/template.rb', line 3 def id @id end |
#liquid_template ⇒ Object (readonly)
Returns the value of attribute liquid_template.
3 4 5 |
# File 'lib/txbr/template.rb', line 3 def liquid_template @liquid_template end |
Instance Method Details
#each_content_tag ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/txbr/template.rb', line 13 def each_content_tag return to_enum(__method__) unless block_given? .each do |content_tag| next unless translation_enabled? yield content_tag end end |
#render ⇒ Object
22 23 24 |
# File 'lib/txbr/template.rb', line 22 def render liquid_template.render end |
#root ⇒ Object
26 27 28 |
# File 'lib/txbr/template.rb', line 26 def root liquid_template.root end |