Class: Glyph::ParameterNode
- Inherits:
-
SyntaxNode
- Object
- Hash
- Node
- SyntaxNode
- Glyph::ParameterNode
- Defined in:
- lib/glyph/syntax_node.rb
Overview
A Glyph macro parameter in Glyph Abstract Syntax Tree
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
-
#contents ⇒ String
A textual representation of the parameter contents.
-
#evaluate(context, options = {:params => false}) ⇒ String
The evaluated child nodes.
-
#to_s ⇒ String
A textual representation of the parameter node.
Methods inherited from SyntaxNode
Methods inherited from Node
#&, #<<, #==, #>>, #ascend, #child, #clear, #descend, #each_child, #find_child, #find_parent, #from, #initialize, #inspect, #root, #to_hash, #to_node
Methods inherited from Hash
Constructor Details
This class inherits a constructor from Node
Instance Method Details
#contents ⇒ String
Returns a textual representation of the parameter contents.
189 190 191 |
# File 'lib/glyph/syntax_node.rb', line 189 def contents parent[:escape] ? ".[=#{children.join}=]" : children.join end |
#evaluate(context, options = {:params => false}) ⇒ String
Returns the evaluated child nodes.
198 199 200 201 202 |
# File 'lib/glyph/syntax_node.rb', line 198 def evaluate(context, ={:params => false}) self[:value] = "" self.children.each {|c| self[:value] << c.evaluate(context) } if [:params] self[:value] end |
#to_s ⇒ String
Returns a textual representation of the parameter node.
183 184 185 |
# File 'lib/glyph/syntax_node.rb', line 183 def to_s children.join end |