Class: RBI::Mixin Abstract

Inherits:
NodeWithComments show all
Defined in:
lib/rbi/model.rb,
lib/rbi/rewriters/merge_trees.rb

Overview

This class is abstract.

Direct Known Subclasses

Extend, Include, MixesInClassMethods

Instance Attribute Summary collapse

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

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, names, loc: nil, comments: []) ⇒ Mixin

: (String name, Array names, ?loc: Loc?, ?comments: Array) -> void



706
707
708
709
# File 'lib/rbi/model.rb', line 706

def initialize(name, names, loc: nil, comments: [])
  super(loc: loc, comments: comments)
  @names = [name, *names] #: Array[String]
end

Instance Attribute Details

#namesObject (readonly)

: Array



703
704
705
# File 'lib/rbi/model.rb', line 703

def names
  @names
end

Instance Method Details

#compatible_with?(other) ⇒ Boolean

: (Node other) -> bool

Returns:

  • (Boolean)


476
477
478
# File 'lib/rbi/rewriters/merge_trees.rb', line 476

def compatible_with?(other)
  other.is_a?(Mixin) && names == other.names
end