Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
RubyVM::AbstractSyntaxTree::Node#type
node.type → symbol
ast.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/ast.rb, line 133
def type
Primitive.ast_node_type
end
Returns the type of this node as a symbol.
Example
root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2") root.type # => :SCOPE lasgn = root.children[2] lasgn.type # => :LASGN call = lasgn.children[1] call.type # => :OPCALL