Module: SyntaxTree::RBS
- Defined in:
- lib/syntax_tree/rbs.rb,
lib/syntax_tree/rbs/format.rb,
lib/syntax_tree/rbs/version.rb,
lib/syntax_tree/rbs/entrypoints.rb,
lib/syntax_tree/rbs/pretty_print.rb,
lib/syntax_tree/rbs/shims.rb
Defined Under Namespace
Modules: Entrypoints
Classes: Format, Formatter, PrettyPrint, Root, Visitor
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
44
45
46
47
48
49
50
|
# File 'lib/syntax_tree/rbs.rb', line 44
def format(source, maxwidth = 80)
formatter = Formatter.new(source, [], maxwidth)
parse(source).format(formatter)
formatter.flush
formatter.output.join
end
|
.parse(source) ⇒ Object
52
53
54
55
|
# File 'lib/syntax_tree/rbs.rb', line 52
def parse(source)
_, _, declarations = ::RBS::Parser.parse_signature(source)
Root.new(declarations)
end
|
.read(filepath) ⇒ Object
57
58
59
|
# File 'lib/syntax_tree/rbs.rb', line 57
def read(filepath)
File.read(filepath)
end
|