Class: Twig::Node::Expression::AssignName
- Defined in:
- lib/twig/node/expression/assign_name.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Name
Instance Attribute Summary
Attributes inherited from Base
#attributes, #lineno, #nodes, #source_context, #tag
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
- 
  
    
      #initialize(name, lineno)  ⇒ AssignName 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of AssignName. 
Methods inherited from Base
#explicit_parentheses?, #set_explicit_parentheses
Methods inherited from Base
Constructor Details
#initialize(name, lineno) ⇒ AssignName
| 11 12 13 14 15 16 17 | # File 'lib/twig/node/expression/assign_name.rb', line 11 def initialize(name, lineno) if %w[true false none null nil].include?(name.downcase) raise Error::Syntax.new("You cannot assign a value to #{name}", lineno) end super end | 
Instance Method Details
#compile(compiler) ⇒ Object
| 19 20 21 22 23 24 | # File 'lib/twig/node/expression/assign_name.rb', line 19 def compile(compiler) compiler. raw('context['). string(attributes[:name]). raw(']') end |