Class: Giblish::IndexConfigBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/config_builders/index_config_builder.rb

Overview

AIDEV-NOTE: Builder for Index configuration following established provider pattern

Class Method Summary collapse

Class Method Details

.build(config_opts, resource_paths, doc_attr, adoc_src_provider_class = SubtreeIndexBase) ⇒ IndexConfig

Builds complete Index configuration with index generation support. Returns a null configuration if index generation is disabled.

Parameters:

  • config_opts (CmdLine::Options)

    User configuration with no_index flag

  • resource_paths (ResourcePaths)

    Resolved paths for templates

  • doc_attr (DocAttrBuilder)

    Document attribute builder

  • adoc_src_provider_class (Class) (defaults to: SubtreeIndexBase)

    Class for generating index source (defaults to SubtreeIndexBase)

Returns:

  • (IndexConfig)

    Configuration with index generation post-builders



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/giblish/config_builders/index_config_builder.rb', line 29

def self.build(config_opts, resource_paths, doc_attr, adoc_src_provider_class = SubtreeIndexBase)
  return null_config if config_opts.no_index

  adoc_src_provider = adoc_src_provider_class.new(
    {erb_template_path: resource_paths.idx_erb_template_abs}
  )

  idx = SubtreeInfoBuilder.new(
    doc_attr,
    nil,
    adoc_src_provider,
    config_opts.index_basename
  )

  IndexConfig.new(post_builders: [idx])
end