class RBI::File
Attributes
comments[RW]
root[R]
strictness[R]
Public Class Methods
new(strictness: nil, comments: [], &block)
click to toggle source
# File lib/rbi/model.rb, line 144 def initialize(strictness: nil, comments: [], &block) @root = T.let(Tree.new, Tree) @strictness = strictness @comments = comments block&.call(self) end
Public Instance Methods
<<(node)
click to toggle source
# File lib/rbi/model.rb, line 152 def <<(node) @root << node end
accept_printer(v)
click to toggle source
# File lib/rbi/printer.rb, line 90 def accept_printer(v) strictness = self.strictness if strictness v.printl("# typed: #{strictness}") end unless comments.empty? v.printn if strictness v.visit_all(comments) end unless root.empty? v.printn if strictness || !comments.empty? v.visit(root) end end
print(out: $stdout, indent: 0, print_locs: false)
click to toggle source
# File lib/rbi/printer.rb, line 107 def print(out: $stdout, indent: 0, print_locs: false) p = Printer.new(out: out, indent: indent, print_locs: print_locs) p.visit_file(self) end
string(indent: 0, print_locs: false)
click to toggle source
# File lib/rbi/printer.rb, line 113 def string(indent: 0, print_locs: false) out = StringIO.new print(out: out, indent: indent, print_locs: print_locs) out.string end