Class: VariableName
- Inherits:
-
BooleanExpr
- Object
- Treetop::Runtime::SyntaxNode
- BooleanExpr
- VariableName
- Defined in:
- lib/emerald/nodes/variable_name.rb
Overview
Variable interpolation in a template
Instance Method Summary collapse
Instance Method Details
#content(context) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/emerald/nodes/variable_name.rb', line 9 def content(context) text_value .split('.') .reduce(context) do |ctx, name| next nil if ctx.nil? ctx[name] || ctx[name.to_sym] || nil end end |
#truthy?(context) ⇒ Boolean
18 19 20 |
# File 'lib/emerald/nodes/variable_name.rb', line 18 def truthy?(context) !!content(context) end |