Class: Chiridion::Engine::RbsLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/chiridion/engine/rbs_loader.rb

Overview

Loads RBS type signatures from sig/ directory for documentation enrichment.

Parses RBS files and extracts method signatures to merge with YARD documentation, providing accurate type information in generated docs.

Instance Method Summary collapse

Constructor Details

#initialize(rbs_path, verbose, logger) ⇒ RbsLoader

Returns a new instance of RbsLoader.



10
11
12
13
14
# File 'lib/chiridion/engine/rbs_loader.rb', line 10

def initialize(rbs_path, verbose, logger)
  @rbs_path = rbs_path
  @verbose  = verbose
  @logger   = logger
end

Instance Method Details

#loadHash{String => Hash{String => Hash}}

Load all RBS files and return a hash of class -> method -> signature.

Returns:

  • (Hash{String => Hash{String => Hash}})

    Nested hash of signatures



19
20
21
22
23
24
25
26
27
28
# File 'lib/chiridion/engine/rbs_loader.rb', line 19

def load
  signatures = {}
  rbs_files  = Dir.glob("#{@rbs_path}/**/*.rbs")

  return signatures if rbs_files.empty?

  @logger.info "Loading #{rbs_files.size} RBS files..." if @verbose
  rbs_files.each { |file| parse_file(file, signatures) }
  signatures
end