Class: Solid::LiquidExtensions::AssignTag
- Extended by:
- TagHighjacker
- Defined in:
- lib/solid/liquid_extensions/assign_tag.rb
Instance Method Summary collapse
- #display(expression_result) ⇒ Object
-
#initialize(tag_name, assignment, tokens, context = {}) ⇒ AssignTag
constructor
A new instance of AssignTag.
Methods included from TagHighjacker
Methods inherited from Tag
Methods included from Element
#arguments, #current_context, included, #with_context
Constructor Details
#initialize(tag_name, assignment, tokens, context = {}) ⇒ AssignTag
Returns a new instance of AssignTag.
8 9 10 11 12 |
# File 'lib/solid/liquid_extensions/assign_tag.rb', line 8 def initialize(tag_name, assignment, tokens, context = {}) @assigned_variable, expression = assignment.split('=', 2) @assigned_variable = @assigned_variable.strip super(tag_name, expression, tokens, context) end |
Instance Method Details
#display(expression_result) ⇒ Object
14 15 16 17 |
# File 'lib/solid/liquid_extensions/assign_tag.rb', line 14 def display(expression_result) current_context.scopes.last[@assigned_variable] = expression_result '' end |