Exception: RBS::DuplicatedMethodDefinitionError
- Inherits:
-
DefinitionError
- Object
- StandardError
- BaseError
- DefinitionError
- RBS::DuplicatedMethodDefinitionError
- Includes:
- DetailedMessageable
- Defined in:
- lib/rbs/errors.rb
Instance Attribute Summary collapse
-
#members ⇒ Object
readonly
Returns the value of attribute members.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, method_name:, members:) ⇒ DuplicatedMethodDefinitionError
constructor
A new instance of DuplicatedMethodDefinitionError.
- #location ⇒ Object
- #other_locations ⇒ Object
- #qualified_method_name ⇒ Object
- #type_name ⇒ Object
Methods included from DetailedMessageable
Constructor Details
#initialize(type:, method_name:, members:) ⇒ DuplicatedMethodDefinitionError
Returns a new instance of DuplicatedMethodDefinitionError.
243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/rbs/errors.rb', line 243 def initialize(type:, method_name:, members:) @type = type @method_name = method_name @members = members = +"#{Location.to_string location}: #{qualified_method_name} has duplicated definitions" if members.size > 1 << " in #{other_locations.map { |loc| Location.to_string loc }.join(', ')}" end super end |
Instance Attribute Details
#members ⇒ Object (readonly)
Returns the value of attribute members.
241 242 243 |
# File 'lib/rbs/errors.rb', line 241 def members @members end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
240 241 242 |
# File 'lib/rbs/errors.rb', line 240 def method_name @method_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
239 240 241 |
# File 'lib/rbs/errors.rb', line 239 def type @type end |
Instance Method Details
#location ⇒ Object
268 269 270 |
# File 'lib/rbs/errors.rb', line 268 def location members[0].location end |
#other_locations ⇒ Object
272 273 274 |
# File 'lib/rbs/errors.rb', line 272 def other_locations members.drop(1).map(&:location) end |
#qualified_method_name ⇒ Object
255 256 257 258 259 260 261 262 |
# File 'lib/rbs/errors.rb', line 255 def qualified_method_name case type when Types::ClassSingleton "#{type.name}.#{method_name}" else "#{type.name}##{method_name}" end end |
#type_name ⇒ Object
264 265 266 |
# File 'lib/rbs/errors.rb', line 264 def type_name type.name end |