class RBI::Mixin

Mixins

Attributes

names[RW]

Public Class Methods

new(name, names, loc: nil, comments: []) click to toggle source
Calls superclass method RBI::NodeWithComments::new
# File lib/rbi/model.rb, line 766
def initialize(name, names, loc: nil, comments: [])
  super(loc: loc, comments: comments)
  @names = T.let([name, *names], T::Array[String])
end

Public Instance Methods

accept_printer(v) click to toggle source
# File lib/rbi/printer.rb, line 509
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(comments)
  case self
  when Include
    v.printt("include")
  when Extend
    v.printt("extend")
  when MixesInClassMethods
    v.printt("mixes_in_class_methods")
  end
  v.printn(" #{names.join(", ")}")
end
compatible_with?(other) click to toggle source
# File lib/rbi/rewriters/merge_trees.rb, line 452
def compatible_with?(other)
  other.is_a?(Mixin) && names == other.names
end