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) ⇒ void
constructor
Initialize.
-
#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) ⇒ void
Initialize
22 23 24 25 26 27 |
# File 'lib/docscribe/types/sorbet/base_provider.rb', line 22 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.
35 36 37 |
# File 'lib/docscribe/types/sorbet/base_provider.rb', line 35 def signature_for(container:, scope:, name:) @index[[normalize_container(container), scope.to_sym, name.to_sym]] end |