Class: Chiridion::Engine::SemanticExtractor
- Inherits:
-
Object
- Object
- Chiridion::Engine::SemanticExtractor
- Includes:
- DocumentModel
- Defined in:
- lib/chiridion/engine/semantic_extractor.rb
Overview
Comprehensive semantic extraction from YARD registry.
Unlike the simpler Extractor, this captures ALL available metadata from YARD and RBS, populating the DocumentModel structures completely. It addresses the “data being discarded” issues documented in TODO.md.
Key improvements over Extractor:
-
@option tags for hash parameter documentation
-
@yield, @yieldparam, @yieldreturn for block documentation
-
@api, @deprecated, @abstract, @note tags
-
@raise exceptions
-
Instance variable types (@rbs @name: Type)
-
Method overloads from RBS
Design: Extract everything, render selectively.
Instance Method Summary collapse
-
#extract(registry, title: "API Documentation", description: nil, root: Dir.pwd) ⇒ ProjectDoc
Extract complete documentation from YARD registry.
-
#initialize(rbs_types:, rbs_attr_types: {}, rbs_ivar_types: {}, type_aliases: {}, spec_examples: {}, namespace_filter: nil, logger: nil) ⇒ SemanticExtractor
constructor
A new instance of SemanticExtractor.
Constructor Details
#initialize(rbs_types:, rbs_attr_types: {}, rbs_ivar_types: {}, type_aliases: {}, spec_examples: {}, namespace_filter: nil, logger: nil) ⇒ SemanticExtractor
Returns a new instance of SemanticExtractor.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/chiridion/engine/semantic_extractor.rb', line 25 def initialize( rbs_types:, rbs_attr_types: {}, rbs_ivar_types: {}, type_aliases: {}, spec_examples: {}, namespace_filter: nil, logger: nil ) @rbs_types = rbs_types || {} @rbs_attr_types = rbs_attr_types || {} @rbs_ivar_types = rbs_ivar_types || {} @type_aliases = type_aliases || {} @spec_examples = spec_examples || {} @namespace_filter = namespace_filter @logger = logger @type_merger = TypeMerger.new(logger) end |
Instance Method Details
#extract(registry, title: "API Documentation", description: nil, root: Dir.pwd) ⇒ ProjectDoc
Extract complete documentation from YARD registry.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/chiridion/engine/semantic_extractor.rb', line 51 def extract(registry, title: "API Documentation", description: nil, root: Dir.pwd) namespaces = registry.all(:class, :module) .select { |obj| should_document?(obj) } .map { |obj| extract_namespace(obj) } files = group_by_file(namespaces, root) ProjectDoc.new( title: title, description: description, namespaces: namespaces, files: files, type_aliases: @type_aliases.transform_values { |types| types.map { |t| to_type_alias_doc(t) } }, generated_at: Time.now.utc ) end |