Class: Mixml::Template::Expression
- Defined in:
- lib/mixml/template/expression.rb
Overview
Eruby based template
Instance Attribute Summary collapse
-
#expression ⇒ Erubis::Eruby
readonly
Template expression.
Instance Method Summary collapse
-
#evaluate(node) ⇒ String
Evaluate the template.
-
#initialize(text) ⇒ Expression
constructor
Initialize a new template.
Methods inherited from Base
Constructor Details
#initialize(text) ⇒ Expression
Initialize a new template
15 16 17 |
# File 'lib/mixml/template/expression.rb', line 15 def initialize(text) @expression = Erubis::Eruby.new(text, :pattern => '{ }') end |
Instance Attribute Details
#expression ⇒ Erubis::Eruby (readonly)
Returns Template expression.
10 11 12 |
# File 'lib/mixml/template/expression.rb', line 10 def expression @expression end |
Instance Method Details
#evaluate(node) ⇒ String
Evaluate the template
23 24 25 26 |
# File 'lib/mixml/template/expression.rb', line 23 def evaluate(node) context = {:node => node} @expression.result(context) end |