Class: LlmDocsBuilder::ParsedContent

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_docs_builder/parser.rb

Overview

Represents parsed llms.txt content with structured access to sections

Provides convenient access to parsed llms.txt sections including title, description, and link collections.

Examples:

Access parsed content

parsed.title              # => "My Project"
parsed.description        # => "A description"
parsed.documentation_links # => [{title: "...", url: "...", description: "..."}]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sections) ⇒ ParsedContent

Initialize parsed content

Parameters:

  • sections (Hash)

    hash containing parsed sections (:title, :description, :documentation, etc.)



126
127
128
# File 'lib/llm_docs_builder/parser.rb', line 126

def initialize(sections)
  @sections = sections
end

Instance Attribute Details

#sectionsHash (readonly)

Returns the parsed sections hash.

Returns:

  • (Hash)

    the parsed sections hash



121
122
123
# File 'lib/llm_docs_builder/parser.rb', line 121

def sections
  @sections
end

Instance Method Details

#descriptionString?

Get the project description

Returns:

  • (String, nil)

    the description blockquote or nil if not present



140
141
142
# File 'lib/llm_docs_builder/parser.rb', line 140

def description
  sections[:description]
end

Get documentation links

Returns:

  • (Array<Hash>)

    array of documentation links with :title, :url, and :description



147
148
149
# File 'lib/llm_docs_builder/parser.rb', line 147

def documentation_links
  sections[:documentation] || []
end

Get example links

Returns:

  • (Array<Hash>)

    array of example links with :title, :url, and :description



154
155
156
# File 'lib/llm_docs_builder/parser.rb', line 154

def example_links
  sections[:examples] || []
end

Get optional links

Returns:

  • (Array<Hash>)

    array of optional links with :title, :url, and :description



161
162
163
# File 'lib/llm_docs_builder/parser.rb', line 161

def optional_links
  sections[:optional] || []
end

#titleString?

Get the project title

Returns:

  • (String, nil)

    the H1 title or nil if not present



133
134
135
# File 'lib/llm_docs_builder/parser.rb', line 133

def title
  sections[:title]
end