Class: RuboCop::Cop::Sorbet::EnforceSignatures::SigSignatureChecker
- Inherits:
-
SignatureChecker
- Object
- SignatureChecker
- RuboCop::Cop::Sorbet::EnforceSignatures::SigSignatureChecker
- Defined in:
- lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb
Constant Summary collapse
- EMPTY_SIGNATURES =
[].freeze
Instance Method Summary collapse
- #clear_signature(scope) ⇒ Object
-
#initialize(processed_source) ⇒ SigSignatureChecker
constructor
A new instance of SigSignatureChecker.
- #on_signature(node, scope) ⇒ Object
- #signature_nodes(scope) ⇒ Object
Constructor Details
#initialize(processed_source) ⇒ SigSignatureChecker
Returns a new instance of SigSignatureChecker.
362 363 364 365 |
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 362 def initialize(processed_source) super(processed_source) @signatures_for_scope = {} end |
Instance Method Details
#clear_signature(scope) ⇒ Object
375 376 377 |
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 375 def clear_signature(scope) @signatures_for_scope.delete(scope) end |
#on_signature(node, scope) ⇒ Object
371 372 373 |
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 371 def on_signature(node, scope) (@signatures_for_scope[scope] ||= []) << node end |
#signature_nodes(scope) ⇒ Object
367 368 369 |
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 367 def signature_nodes(scope) @signatures_for_scope.fetch(scope, EMPTY_SIGNATURES) end |