Class: RBI::Module
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb,
lib/rbi/rewriters/merge_trees.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Tree
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #compatible_with?(other) ⇒ Boolean
- #fully_qualified_name ⇒ Object
-
#initialize(name, loc: nil, comments: [], &block) ⇒ Module
constructor
A new instance of Module.
- #print_header(v) ⇒ Object
Methods inherited from Scope
#accept_printer, #dup_empty, #index_ids, #print_body, #to_s
Methods included from Indexable
Methods inherited from Tree
#<<, #accept_printer, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #group_nodes!, #index, #merge, #nest_non_public_methods!, #nest_singleton_methods!, #oneline?, #sort_nodes!
Methods inherited from NodeWithComments
#annotations, #merge_with, #oneline?
Methods inherited from Node
#accept_printer, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #print_blank_line_before, #replace, #string
Constructor Details
#initialize(name, loc: nil, comments: [], &block) ⇒ Module
Returns a new instance of Module.
200 201 202 203 204 |
# File 'lib/rbi/model.rb', line 200 def initialize(name, loc: nil, comments: [], &block) super(loc: loc, comments: comments) {} @name = name block&.call(self) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
190 191 192 |
# File 'lib/rbi/model.rb', line 190 def name @name end |
Instance Method Details
#compatible_with?(other) ⇒ Boolean
379 380 381 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 379 def compatible_with?(other) other.is_a?(Module) end |
#fully_qualified_name ⇒ Object
207 208 209 210 |
# File 'lib/rbi/model.rb', line 207 def fully_qualified_name return name if name.start_with?("::") "#{parent_scope&.fully_qualified_name}::#{name}" end |
#print_header(v) ⇒ Object
240 241 242 243 244 245 246 247 |
# File 'lib/rbi/printer.rb', line 240 def print_header(v) v.printt("module #{name}") if empty? v.printn("; end") else v.printn end end |