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.)



128
129
130
# File 'lib/llm_docs_builder/parser.rb', line 128

def initialize(sections)
  @sections = sections
end

Instance Attribute Details

#sectionsHash (readonly)

Returns the parsed sections hash.

Returns:

  • (Hash)

    the parsed sections hash



123
124
125
# File 'lib/llm_docs_builder/parser.rb', line 123

def sections
  @sections
end

Instance Method Details

#descriptionString?

Get the project description

Returns:

  • (String, nil)

    the description blockquote or nil if not present



142
143
144
# File 'lib/llm_docs_builder/parser.rb', line 142

def description
  sections[:description]
end

Get documentation links

Returns:

  • (Array<Hash>)

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



149
150
151
# File 'lib/llm_docs_builder/parser.rb', line 149

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

Get example links

Returns:

  • (Array<Hash>)

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



156
157
158
# File 'lib/llm_docs_builder/parser.rb', line 156

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

Get optional links

Returns:

  • (Array<Hash>)

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



163
164
165
# File 'lib/llm_docs_builder/parser.rb', line 163

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

#titleString?

Get the project title

Returns:

  • (String, nil)

    the H1 title or nil if not present



135
136
137
# File 'lib/llm_docs_builder/parser.rb', line 135

def title
  sections[:title]
end