Class: RBI::File
- Inherits:
-
Object
- Object
- RBI::File
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb,
lib/rbi/rbs_printer.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#root ⇒ Object
Returns the value of attribute root.
-
#strictness ⇒ Object
Returns the value of attribute strictness.
Instance Method Summary collapse
- #<<(node) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(strictness: nil, comments: [], &block) ⇒ File
constructor
A new instance of File.
- #print(out: $stdout, indent: 0, print_locs: false, max_line_length: nil) ⇒ Object
- #rbs_print(out: $stdout, indent: 0, print_locs: false) ⇒ Object
- #rbs_string(indent: 0, print_locs: false) ⇒ Object
- #string(indent: 0, print_locs: false, max_line_length: nil) ⇒ Object
Constructor Details
#initialize(strictness: nil, comments: [], &block) ⇒ File
Returns a new instance of File.
158 159 160 161 162 163 |
# File 'lib/rbi/model.rb', line 158 def initialize(strictness: nil, comments: [], &block) @root = T.let(Tree.new, Tree) @strictness = strictness @comments = comments block&.call(self) end |
Instance Attribute Details
#comments ⇒ Object
Returns the value of attribute comments.
149 150 151 |
# File 'lib/rbi/model.rb', line 149 def comments @comments end |
#root ⇒ Object
Returns the value of attribute root.
143 144 145 |
# File 'lib/rbi/model.rb', line 143 def root @root end |
#strictness ⇒ Object
Returns the value of attribute strictness.
146 147 148 |
# File 'lib/rbi/model.rb', line 146 def strictness @strictness end |
Instance Method Details
#<<(node) ⇒ Object
166 167 168 |
# File 'lib/rbi/model.rb', line 166 def <<(node) @root << node end |
#empty? ⇒ Boolean
171 172 173 |
# File 'lib/rbi/model.rb', line 171 def empty? @root.empty? end |
#print(out: $stdout, indent: 0, print_locs: false, max_line_length: nil) ⇒ Object
743 744 745 746 |
# File 'lib/rbi/printer.rb', line 743 def print(out: $stdout, indent: 0, print_locs: false, max_line_length: nil) p = Printer.new(out: out, indent: indent, print_locs: print_locs, max_line_length: max_line_length) p.visit_file(self) end |
#rbs_print(out: $stdout, indent: 0, print_locs: false) ⇒ Object
989 990 991 992 |
# File 'lib/rbi/rbs_printer.rb', line 989 def rbs_print(out: $stdout, indent: 0, print_locs: false) p = RBSPrinter.new(out: out, indent: indent, print_locs: print_locs) p.visit_file(self) end |
#rbs_string(indent: 0, print_locs: false) ⇒ Object
995 996 997 998 999 |
# File 'lib/rbi/rbs_printer.rb', line 995 def rbs_string(indent: 0, print_locs: false) out = StringIO.new rbs_print(out: out, indent: indent, print_locs: print_locs) out.string end |
#string(indent: 0, print_locs: false, max_line_length: nil) ⇒ Object
749 750 751 752 753 |
# File 'lib/rbi/printer.rb', line 749 def string(indent: 0, print_locs: false, max_line_length: nil) out = StringIO.new print(out: out, indent: indent, print_locs: print_locs, max_line_length: max_line_length) out.string end |