Class: RubyIndexer::RBSIndexer

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb

Constant Summary collapse

HAS_UNTYPED_FUNCTION =

: bool

!!defined?(RBS::Types::UntypedFunction) #: bool

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ RBSIndexer

: (Index index) -> void



9
10
11
# File 'lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb', line 9

def initialize(index)
  @index = index
end

Instance Method Details

#index_ruby_coreObject

: -> void



14
15
16
17
18
19
20
21
# File 'lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb', line 14

def index_ruby_core
  loader = RBS::EnvironmentLoader.new
  RBS::Environment.from_loader(loader).resolve_type_names

  loader.each_signature do |_source, pathname, _buffer, declarations, _directives|
    process_signature(pathname, declarations)
  end
end

#process_signature(pathname, declarations) ⇒ Object

: (Pathname pathname, Array declarations) -> void



24
25
26
27
28
# File 'lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb', line 24

def process_signature(pathname, declarations)
  declarations.each do |declaration|
    process_declaration(declaration, pathname)
  end
end