Exception: RBS::DuplicatedInterfaceMethodDefinitionError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DetailedMessageable

#detailed_message

Constructor Details

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

Returns a new instance of DuplicatedInterfaceMethodDefinitionError.



291
292
293
294
295
296
297
# File 'lib/rbs/errors.rb', line 291

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.



289
290
291
# File 'lib/rbs/errors.rb', line 289

def member
  @member
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



288
289
290
# File 'lib/rbs/errors.rb', line 288

def method_name
  @method_name
end

#typeObject (readonly)

Returns the value of attribute type.



287
288
289
# File 'lib/rbs/errors.rb', line 287

def type
  @type
end

Instance Method Details

#locationObject



299
300
301
# File 'lib/rbs/errors.rb', line 299

def location
  member.location
end

#qualified_method_nameObject



303
304
305
306
307
308
309
310
# File 'lib/rbs/errors.rb', line 303

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

#type_nameObject



312
313
314
# File 'lib/rbs/errors.rb', line 312

def type_name
  type.name
end