Exception: RBS::DuplicatedInterfaceMethodDefinitionError

Inherits:
DefinitionError show all
Defined in:
lib/rbs/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, method_name:, member:) ⇒ DuplicatedInterfaceMethodDefinitionError

Returns a new instance of DuplicatedInterfaceMethodDefinitionError.



275
276
277
278
279
280
281
# File 'lib/rbs/errors.rb', line 275

def initialize(type:, method_name:, member:)
  @type = type
  @method_name = method_name
  @member = member

  super "#{member.location}: Duplicated method definition: #{qualified_method_name}"
end

Instance Attribute Details

#memberObject (readonly)

Returns the value of attribute member.



273
274
275
# File 'lib/rbs/errors.rb', line 273

def member
  @member
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



272
273
274
# File 'lib/rbs/errors.rb', line 272

def method_name
  @method_name
end

#typeObject (readonly)

Returns the value of attribute type.



271
272
273
# File 'lib/rbs/errors.rb', line 271

def type
  @type
end

Instance Method Details

#qualified_method_nameObject



283
284
285
286
287
288
289
290
# File 'lib/rbs/errors.rb', line 283

def qualified_method_name
  case type
  when Types::ClassSingleton
    "#{type.name}.#{method_name}"
  else
    "#{type.name}##{method_name}"
  end
end

#type_nameObject



292
293
294
# File 'lib/rbs/errors.rb', line 292

def type_name
  type.name
end