Class: Docscribe::Types::Sorbet::BaseProvider
- Inherits:
-
Object
- Object
- Docscribe::Types::Sorbet::BaseProvider
- Defined in:
- lib/docscribe/types/sorbet/base_provider.rb
Overview
Shared base for Sorbet-backed signature providers.
This class parses Sorbet-style signatures through the RBS RBI prototype API and indexes them into Docscribe’s normalized signature model.
Concrete subclasses decide where the Sorbet source comes from:
-
SourceProvider => inline ‘sig` declarations in the current Ruby file
-
RBIProvider => project RBI files
Direct Known Subclasses
Instance Method Summary collapse
- #initialize(collapse_generics: false) ⇒ Object constructor
-
#signature_for(container:, scope:, name:) ⇒ Docscribe::Types::MethodSignature?
Look up a normalized method signature by container, scope, and name.
Constructor Details
#initialize(collapse_generics: false) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/docscribe/types/sorbet/base_provider.rb', line 21 def initialize(collapse_generics: false) require 'rbs' @collapse_generics = !!collapse_generics @index = {} @warned = false end |
Instance Method Details
#signature_for(container:, scope:, name:) ⇒ Docscribe::Types::MethodSignature?
Look up a normalized method signature by container, scope, and name.
34 35 36 |
# File 'lib/docscribe/types/sorbet/base_provider.rb', line 34 def signature_for(container:, scope:, name:) @index[[normalize_container(container), scope.to_sym, name.to_sym]] end |