In Files

  • rbs-1.0.4/lib/rbs/errors.rb

Class/Module Index [+]

Quicksearch

RBS::DuplicatedMethodDefinitionError

Attributes

members[R]
method_name[R]
type[R]

Public Class Methods

new(type:, method_name:, members:) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/errors.rb, line 182
def initialize(type,, method_name,, members))
  @type = type
  @method_name = method_name
  @members = members

  message = "#{Location.to_string location}: #{qualified_method_name} has duplicated definitions"
  if members.size > 1
    message << " in #{other_locations.map { |loc| Location.to_string loc }.join(', ')}"
  end
  super message
end
            

Public Instance Methods

location() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/errors.rb, line 203
def location
  members[0].location
end
            
other_locations() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/errors.rb, line 207
def other_locations
  members.drop(1).map(&:location)
end
            
qualified_method_name() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/errors.rb, line 194
def qualified_method_name
  case type
  when Types::ClassSingleton
    "#{type.name}.#{method_name}"
  else
    "#{type.name}##{method_name}"
  end
end