Class: Rubasteme::AST::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/rubasteme/ast.rb

Direct Known Subclasses

BranchNode, IllegalNode, LeafNode

Instance Method Summary collapse

Constructor Details

#initialize(_literal = nil) ⇒ Node

Returns a new instance of Node.



74
75
# File 'lib/rubasteme/ast.rb', line 74

def initialize(_literal = nil)
end

Instance Method Details

#to_aObject



83
# File 'lib/rubasteme/ast.rb', line 83

def to_a; []; end

#to_sObject



84
# File 'lib/rubasteme/ast.rb', line 84

def to_s; to_a.to_s; end

#typeObject



77
78
79
80
81
# File 'lib/rubasteme/ast.rb', line 77

def type
  klass_name = self.class.name.split("::")[-1]
  type_name = Utils.snake_case(klass_name.delete_suffix("Node"))
  "ast_#{type_name}".intern
end