Class: RBI::MixesInClassMethods

Inherits:
Mixin show all
Includes:
Indexable
Defined in:
lib/rbi/index.rb,
lib/rbi/model.rb,
lib/rbi/rewriters/merge_trees.rb

Instance Attribute Summary

Attributes inherited from Mixin

#names

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from NodeWithComments

#annotations, #comments?, #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: nil, &block) ⇒ MixesInClassMethods

Returns a new instance of MixesInClassMethods.

Signature:

  • (

  • String name,

  • *String names,

  • ?loc: Loc?,

  • ?comments: Array[Comment]?

  • ) ?{ (MixesInClassMethods node) -> void } -> void



1360
1361
1362
1363
# File 'lib/rbi/model.rb', line 1360

def initialize(name, *names, loc: nil, comments: nil, &block)
  super(name, names, loc: loc, comments: comments)
  block&.call(self)
end

Instance Method Details

#compatible_with?(other) ⇒ Boolean

Signature:

  • (Node other) -> bool

Returns:

  • (Boolean)


575
576
577
# File 'lib/rbi/rewriters/merge_trees.rb', line 575

def compatible_with?(other)
  other.is_a?(MixesInClassMethods) && super
end

#index_idsObject

Signature:

  • -> Array[String]



144
145
146
# File 'lib/rbi/index.rb', line 144

def index_ids
  names.map { |name| "#{parent_scope&.fully_qualified_name}.mixes_in_class_method(#{name})" }
end

#to_sObject

Signature:

  • -> String



1367
1368
1369
# File 'lib/rbi/model.rb', line 1367

def to_s
  "#{parent_scope&.fully_qualified_name}.mixes_in_class_methods(#{names.join(", ")})"
end