Class: Docscribe::Types::Sorbet::SourceProvider

Inherits:
BaseProvider
  • Object
show all
Defined in:
lib/docscribe/types/sorbet/source_provider.rb

Overview

Sorbet provider for inline signatures present in the current Ruby source.

This provider parses the source being rewritten and indexes any leading ‘sig` declarations it can resolve through the RBS RBI prototype bridge.

Instance Method Summary collapse

Methods inherited from BaseProvider

#signature_for

Constructor Details

#initialize(source:, file:, collapse_generics: false) ⇒ Object

Parameters:

  • source (String)

    Ruby source containing inline ‘sig` declarations

  • file (String)

    source label used in diagnostics/debug warnings

  • collapse_generics (Boolean) (defaults to: false)

    whether generic container types should be simplified during formatting



18
19
20
21
# File 'lib/docscribe/types/sorbet/source_provider.rb', line 18

def initialize(source:, file:, collapse_generics: false)
  super(collapse_generics: collapse_generics)
  load_from_string(source, label: file)
end