Class: Liquid::Assign
Constant Summary collapse
- Syntax =
/(\w+)\s*=\s*(#{AllowedVariableCharacters}+)/
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary collapse
-
#initialize(markup, tokens) ⇒ Assign
constructor
A new instance of Assign.
- #render(context) ⇒ Object
Methods inherited from Tag
Constructor Details
#initialize(markup, tokens) ⇒ Assign
Returns a new instance of Assign.
6 7 8 9 10 11 12 13 |
# File 'lib/liquid/standardtags.rb', line 6 def initialize(markup, tokens) if markup =~ Syntax @to = $1 @from = $2 else raise SyntaxError.new("Syntax Error in 'assign' - Valid syntax: assign [var] = [source]") end end |
Instance Method Details
#render(context) ⇒ Object
15 16 17 18 |
# File 'lib/liquid/standardtags.rb', line 15 def render(context) context[@to] = context[@from] '' end |