class RBS::DefinitionBuilder::MethodBuilder::Methods

Constants

Definition

Attributes

methods[R]
type[R]

Public Class Methods

new(type:) click to toggle source
# File rbs-3.4.4/lib/rbs/definition_builder/method_builder.rb, line 30
def initialize(type:)
  @type = type
  @methods = {}
end

Public Instance Methods

each() { |scc| ... } click to toggle source
# File rbs-3.4.4/lib/rbs/definition_builder/method_builder.rb, line 49
def each
  if block_given?
    Sorter.new(methods).each_strongly_connected_component do |scc|
      if scc.size > 1
        raise RecursiveAliasDefinitionError.new(type: type, defs: scc)
      end

      yield scc[0]
    end
  else
    enum_for :each
  end
end
validate!() click to toggle source
# File rbs-3.4.4/lib/rbs/definition_builder/method_builder.rb, line 35
def validate!
  methods.each_value do |defn|
    if defn.originals.size > 1
      raise DuplicatedMethodDefinitionError.new(
        type: type,
        method_name: defn.name,
        members: defn.originals
      )
    end
  end

  self
end