Class: RBI::Parser

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/rbi/parser.rb

Defined Under Namespace

Classes: SigBuilder, TreeBuilder, Visitor

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_file(path) ⇒ Object



65
66
67
# File 'lib/rbi/parser.rb', line 65

def parse_file(path)
  Parser.new.parse_file(path)
end

.parse_files(paths) ⇒ Object



70
71
72
73
# File 'lib/rbi/parser.rb', line 70

def parse_files(paths)
  parser = Parser.new
  paths.map { |path| parser.parse_file(path) }
end

.parse_string(string) ⇒ Object



60
61
62
# File 'lib/rbi/parser.rb', line 60

def parse_string(string)
  Parser.new.parse_string(string)
end

.parse_strings(strings) ⇒ Object



76
77
78
79
# File 'lib/rbi/parser.rb', line 76

def parse_strings(strings)
  parser = Parser.new
  strings.map { |string| parser.parse_string(string) }
end

Instance Method Details

#parse_file(path) ⇒ Object



88
89
90
# File 'lib/rbi/parser.rb', line 88

def parse_file(path)
  parse(::File.read(path), file: path)
end

#parse_string(string) ⇒ Object



83
84
85
# File 'lib/rbi/parser.rb', line 83

def parse_string(string)
  parse(string, file: "-")
end