Exception: RBS::DuplicatedMethodDefinitionError
- Inherits:
-
StandardError
- Object
- StandardError
- RBS::DuplicatedMethodDefinitionError
- 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
Constructor Details
#initialize(type:, method_name:, members:) ⇒ DuplicatedMethodDefinitionError
Returns a new instance of DuplicatedMethodDefinitionError.
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/rbs/errors.rb', line 179 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.
177 178 179 |
# File 'lib/rbs/errors.rb', line 177 def members @members end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
176 177 178 |
# File 'lib/rbs/errors.rb', line 176 def method_name @method_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
175 176 177 |
# File 'lib/rbs/errors.rb', line 175 def type @type end |
Instance Method Details
#location ⇒ Object
200 201 202 |
# File 'lib/rbs/errors.rb', line 200 def location members[0].location end |
#other_locations ⇒ Object
204 205 206 |
# File 'lib/rbs/errors.rb', line 204 def other_locations members.drop(1).map(&:location) end |
#qualified_method_name ⇒ Object
191 192 193 194 195 196 197 198 |
# File 'lib/rbs/errors.rb', line 191 def qualified_method_name case type when Types::ClassSingleton "#{type.name}.#{method_name}" else "#{type.name}##{method_name}" end end |