Class: Personify::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/personify/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#templateObject (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