Class: TL1::AST::Node
Overview
The base class for all AST nodes
Direct Known Subclasses
ColonSeparatedVariables, CommaSeparatedKeywordVariables, CommaSeparatedVariables, Literal, Variable
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
79 80 81 |
# File 'lib/tl1/ast.rb', line 79 def fields @fields end |
Instance Method Details
#<=>(other) ⇒ Object
81 82 83 84 |
# File 'lib/tl1/ast.rb', line 81 def <=>(other) return unless other.is_a?(Node) fields <=> other.fields end |
#as_json(fields = nil) ⇒ Object
86 87 88 89 |
# File 'lib/tl1/ast.rb', line 86 def as_json(fields = nil) fields ||= @fields { node: NODES_BY_CLASS[self.class], fields: fields } end |
#to_json ⇒ Object
91 92 93 |
# File 'lib/tl1/ast.rb', line 91 def to_json as_json.to_json end |