End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
RubyVM::AbstractSyntaxTree::Node#type
node.type → symbol
ast.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/ast.rb, line 88
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