Module: LlmDocsBuilder::Transformers::BaseTransformer

Included in:
ContentCleanupTransformer, EnhancementTransformer, HeadingTransformer, LinkTransformer, WhitespaceTransformer
Defined in:
lib/llm_docs_builder/transformers/base_transformer.rb

Overview

Base module for all transformers

Provides a common interface for content transformation operations. Each transformer should implement the ‘transform` method.

Instance Method Summary collapse

Instance Method Details

#should_transform?(options) ⇒ Boolean

Note:

Options vary by implementation - see specific transformer classes for supported keys

Check if transformation should be applied

Parameters:

  • options (Hash)

    transformation options

Options Hash (options):

  • :* (Object)

    options vary by implementation - see specific transformer classes

Returns:

  • (Boolean)

    true if transformation should be applied



37
38
39
# File 'lib/llm_docs_builder/transformers/base_transformer.rb', line 37

def should_transform?(options)
  true
end

#transform(content, options = {}) ⇒ String

This method is abstract.

Subclasses must implement this method and document specific options

Note:

Options vary by implementation - see specific transformer classes for supported keys

Transform content

Parameters:

  • content (String)

    markdown content

  • options (Hash) (defaults to: {})

    transformation options

Options Hash (options):

  • :* (Object)

    options vary by implementation - see specific transformer classes

Returns:

  • (String)

    transformed content

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/llm_docs_builder/transformers/base_transformer.rb', line 27

def transform(content, options = {})
  raise NotImplementedError, "#{self.class} must implement #transform"
end