End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
RubyVM::AbstractSyntaxTree.parse_file
RubyVM::AbstractSyntaxTree.parse_file(pathname) → RubyVM::AbstractSyntaxTree::Node
ast.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/ast.rb, line 49
def self.parse_file pathname
Primitive.ast_s_parse_file pathname
end
Reads the file from pathname, then parses it like ::parse, returning the root node of the abstract syntax tree.
SyntaxError is raised if pathname’s contents are not valid Ruby syntax.
Example
RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb") # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-31:3>