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
#<<, #empty?, #group_nodes!, #index, #initialize, #merge, #nest_non_public_methods!, #nest_singleton_methods!, #oneline?, #sort_nodes!
#initialize, #merge_with, #oneline?
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #initialize, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
This class inherits a constructor from RBI::Tree
Instance Method Details
#accept_printer(v) ⇒ Object
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/rbi/printer.rb', line 186
def accept_printer(v)
previous_node = v.previous_node
v.printn if previous_node && (!previous_node.oneline? || !oneline?)
v.printl("# #{loc}") if loc && v.print_locs
v.visit_all()
(v)
print_body(v)
end
|
#dup_empty ⇒ Object
297
298
299
300
301
302
303
304
305
306
307
308
|
# File 'lib/rbi/rewriters/merge_trees.rb', line 297
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 SingletonClass
SingletonClass.new(loc: loc, comments: )
else
raise "Can't duplicate node #{self}"
end
end
|
#fully_qualified_name ⇒ Object
156
|
# File 'lib/rbi/model.rb', line 156
def fully_qualified_name; end
|
#index_ids ⇒ Object
82
83
84
|
# File 'lib/rbi/index.rb', line 82
def index_ids
[fully_qualified_name]
end
|
#print_body(v) ⇒ Object
201
202
203
204
205
206
207
208
|
# File 'lib/rbi/printer.rb', line 201
def print_body(v)
unless empty?
v.indent
v.visit_all(nodes)
v.dedent
v.printl("end")
end
end
|
198
|
# File 'lib/rbi/printer.rb', line 198
def (v); end
|
#to_s ⇒ Object
159
160
161
|
# File 'lib/rbi/model.rb', line 159
def to_s
fully_qualified_name
end
|