Class: Chiridion::Engine::Extractor
- Inherits:
-
Object
- Object
- Chiridion::Engine::Extractor
- Defined in:
- lib/chiridion/engine/extractor.rb
Overview
Extracts documentation structure from YARD registry.
Parses Ruby source using YARD and builds a structured representation of classes, modules, methods, and constants for documentation generation. Merges RBS type signatures when available.
Instance Method Summary collapse
-
#extract(registry, source_filter: nil) ⇒ Hash
Extract documentation structure from YARD registry.
-
#initialize(rbs_types, spec_examples, namespace_filter, logger = nil, rbs_file_namespaces: {}, type_aliases: {}) ⇒ Extractor
constructor
A new instance of Extractor.
Constructor Details
#initialize(rbs_types, spec_examples, namespace_filter, logger = nil, rbs_file_namespaces: {}, type_aliases: {}) ⇒ Extractor
Returns a new instance of Extractor.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/chiridion/engine/extractor.rb', line 11 def initialize(rbs_types, spec_examples, namespace_filter, logger = nil, rbs_file_namespaces: {}, type_aliases: {}) @rbs_types = rbs_types @spec_examples = spec_examples @namespace_filter = namespace_filter @logger = logger @type_merger = TypeMerger.new(logger) @rbs_file_namespaces = rbs_file_namespaces || {} @type_aliases = type_aliases || {} @type_alias_lookup = build_type_alias_lookup end |
Instance Method Details
#extract(registry, source_filter: nil) ⇒ Hash
Extract documentation structure from YARD registry.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chiridion/engine/extractor.rb', line 30 def extract(registry, source_filter: nil) structure = { namespaces: [], classes: [], modules: [] } @source_filter = source_filter&.map { |f| File.(f) } registry.all(:class, :module).each do |obj| next unless should_document?(obj) doc = extract_object(obj) structure[:classes] << doc if obj.is_a?(YARD::CodeObjects::ClassObject) structure[:modules] << doc if obj.is_a?(YARD::CodeObjects::ModuleObject) end structure end |