Class: RBI::Scope
- Inherits:
-
Tree
show all
- Extended by:
- T::Helpers, T::Sig
- Includes:
- Indexable
- Defined in:
- lib/rbi/model.rb,
lib/rbi/index.rb,
lib/rbi/printer.rb,
lib/rbi/rewriters/merge_trees.rb
Overview
Instance Attribute Summary
Attributes inherited from Tree
#nodes
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
Methods inherited from Tree
#<<, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #group_nodes!, #index, #initialize, #merge, #nest_non_public_methods!, #nest_singleton_methods!, #oneline?, #sort_nodes!
#annotations, #initialize, #merge_with, #oneline?
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #initialize, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #print_blank_line_before, #replace, #string
Constructor Details
This class inherits a constructor from RBI::Tree
Instance Method Details
#accept_printer(v) ⇒ Object
212
213
214
215
216
217
218
219
220
|
# File 'lib/rbi/printer.rb', line 212
def accept_printer(v)
print_blank_line_before(v)
v.printl("# #{loc}") if loc && v.print_locs
v.visit_all()
(v)
print_body(v)
end
|
#dup_empty ⇒ Object
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
# File 'lib/rbi/rewriters/merge_trees.rb', line 350
def dup_empty
case self
when Module
Module.new(name, loc: loc, comments: )
when Class
Class.new(name, superclass_name: superclass_name, loc: loc, comments: )
when Struct
Struct.new(name, members: members, keyword_init: keyword_init, loc: loc, comments: )
when SingletonClass
SingletonClass.new(loc: loc, comments: )
else
raise "Can't duplicate node #{self}"
end
end
|
#fully_qualified_name ⇒ Object
178
|
# File 'lib/rbi/model.rb', line 178
def fully_qualified_name; end
|
#index_ids ⇒ Object
89
90
91
|
# File 'lib/rbi/index.rb', line 89
def index_ids
[fully_qualified_name]
end
|
#print_body(v) ⇒ Object
226
227
228
229
230
231
232
233
|
# File 'lib/rbi/printer.rb', line 226
def print_body(v)
unless empty?
v.indent
v.visit_all(nodes)
v.dedent
v.printl("end")
end
end
|
223
|
# File 'lib/rbi/printer.rb', line 223
def (v); end
|
#to_s ⇒ Object
181
182
183
|
# File 'lib/rbi/model.rb', line 181
def to_s
fully_qualified_name
end
|