Exception: RBS::DuplicatedMethodDefinitionError
- Inherits:
-
StandardError
- Object
- StandardError
- RBS::DuplicatedMethodDefinitionError
- Defined in:
- lib/rbs/errors.rb
Instance Attribute Summary collapse
-
#decl ⇒ Object
readonly
Returns the value of attribute decl.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(decl:, name:, location:) ⇒ DuplicatedMethodDefinitionError
constructor
A new instance of DuplicatedMethodDefinitionError.
Constructor Details
#initialize(decl:, name:, location:) ⇒ DuplicatedMethodDefinitionError
Returns a new instance of DuplicatedMethodDefinitionError.
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/rbs/errors.rb', line 107 def initialize(decl:, name:, location:) decl_str = case decl when AST::Declarations::Interface, AST::Declarations::Class, AST::Declarations::Module decl.name.to_s when AST::Declarations::Extension "#{decl.name} (#{decl.extension_name})" end super "#{Location.to_string location}: #{decl_str} has duplicated method definition: #{name}" end |
Instance Attribute Details
#decl ⇒ Object (readonly)
Returns the value of attribute decl.
104 105 106 |
# File 'lib/rbs/errors.rb', line 104 def decl @decl end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
105 106 107 |
# File 'lib/rbs/errors.rb', line 105 def location @location end |
Class Method Details
.check!(decl:, methods:, name:, location:) ⇒ Object
118 119 120 121 122 |
# File 'lib/rbs/errors.rb', line 118 def self.check!(decl:, methods:, name:, location:) if methods.key?(name) raise new(decl: decl, name: name, location: location) end end |