lib/parlour/rbi_generator/class_namespace.rb
# Given an array of {Namespace} instances, returns true if they may
# be merged into this instance using {merge_into_self}. For instances to
# be mergeable, they must either all be abstract or all not be abstract,
# and they must define the same superclass (or none at all).
#
# @param others [Array<RbiGenerator::RbiObject>] An array of other {Namespace} instances.
# @return [Boolean] Whether this instance may be merged with them.
Given an array of {Namespace} instances, returns true if they may
be merged into this instance using {merge_into_self}. For instances to
be mergeable, they must either all be abstract or all not be abstract,
and they must define the same superclass (or none at all).
Given an array of { Namespace } instances returns true if they may be merged into this instance using { merge_into_self } . For instances to be mergeable they must either all be abstract or all not be abstract and they must define the same superclass ( or none at all ) .
def mergeable?(others)
        others = T.cast(others, T::Array[Namespace]) rescue (return false)
        all = others + [self]
        all_classes = T.cast(all.select { |x| ClassNamespace === x }, T::Array[ClassNamespace])
        all_classes.map(&:abstract).uniq.length == 1 &&
          all_classes.map(&:superclass).compact.uniq.length <= 1
      end
def mergeable? ( others ) others = T . cast ( others , T :: Array [ Namespace ] ) rescue ( return false ) all = others + [ self ] all_classes = T . cast ( all . select { | x | ClassNamespace === x } , T :: Array [ ClassNamespace ] ) all_classes . map ( & :abstract ) . uniq . length == 1 && all_classes . map ( & :superclass ) . compact . uniq . length <= 1 end
Given an array of {Namespace} instances, returns true if they may
be merged into this instance using {merge_into_self}.
Given an array of { Namespace } instances returns true if they may be merged into this instance using { merge_into_self } .
Whether this instance may be merged with them.
Whether this instance may be merged with them .
Boolean
others
An array of other {Namespace} instances.
An array of other { Namespace } instances .