Class: RBI::Class
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/rewriters/merge_trees.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#superclass_name ⇒ Object
Returns the value of attribute superclass_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, superclass_name: nil, loc: nil, comments: [], &block) ⇒ Class
constructor
A new instance of Class.
Methods inherited from Scope
Methods included from Indexable
Methods inherited from Tree
#<<, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #filter_versions!, #flatten_singleton_methods!, #flatten_visibilities!, #group_nodes!, #index, #merge, #nest_non_public_members!, #nest_singleton_methods!, #nest_top_level_members!, #replace_attributes_with_methods!, #sort_nodes!
Methods inherited from NodeWithComments
#annotations, #merge_with, #version_requirements
Methods inherited from Node
#detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string
Constructor Details
#initialize(name, superclass_name: nil, loc: nil, comments: [], &block) ⇒ Class
Returns a new instance of Class.
238 239 240 241 242 243 |
# File 'lib/rbi/model.rb', line 238 def initialize(name, superclass_name: nil, loc: nil, comments: [], &block) super(loc: loc, comments: comments) {} @name = name @superclass_name = superclass_name block&.call(self) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
224 225 226 |
# File 'lib/rbi/model.rb', line 224 def name @name end |
#superclass_name ⇒ Object
Returns the value of attribute superclass_name.
227 228 229 |
# File 'lib/rbi/model.rb', line 227 def superclass_name @superclass_name end |
Instance Method Details
#compatible_with?(other) ⇒ Boolean
384 385 386 |
# File 'lib/rbi/rewriters/merge_trees.rb', line 384 def compatible_with?(other) other.is_a?(Class) && superclass_name == other.superclass_name end |
#fully_qualified_name ⇒ Object
246 247 248 249 250 |
# File 'lib/rbi/model.rb', line 246 def fully_qualified_name return name if name.start_with?("::") "#{parent_scope&.fully_qualified_name}::#{name}" end |