Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/melbourne.rb
Class Method Summary collapse
-
.to_ast(name, line = 1) ⇒ Object
Creates an AST for Ruby source code read from a file.
Class Method Details
.to_ast(name, line = 1) ⇒ Object
Creates an AST for Ruby source code read from a file.
Example
File.to_ast('user.rb') # => <AST::Class:0x1017800f8...
Arguments
-
name: the name of the file to read the source code from. -
line: the starting line (if it’s not 1 for some reason); defaults to1
42 43 44 |
# File 'lib/melbourne.rb', line 42 def self.to_ast(name, line = 1) Melbourne::Parser.parse_file(name, line) end |