Class: Personify::Template
- Inherits:
-
Object
- Object
- Personify::Template
- Defined in:
- lib/personify/template.rb
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(template) ⇒ Template
constructor
A new instance of Template.
- #render(local_assigns = {}, context = DefaultContext.new) ⇒ Object
Constructor Details
#initialize(template) ⇒ Template
Returns a new instance of Template.
6 7 8 9 |
# File 'lib/personify/template.rb', line 6 def initialize(template) parser = PersonifyLanguageParser.new @template = parser.parse(template) end |
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
4 5 6 |
# File 'lib/personify/template.rb', line 4 def template @template end |
Instance Method Details
#render(local_assigns = {}, context = DefaultContext.new) ⇒ Object
11 12 13 14 |
# File 'lib/personify/template.rb', line 11 def render(local_assigns={}, context = DefaultContext.new) context.local_assigns = local_assigns @template.eval(context) end |