Class: Jekyll::Llms::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/llms/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site:, item:, section:) ⇒ Entry

Returns a new instance of Entry.



8
9
10
11
12
13
# File 'lib/jekyll/llms/entry.rb', line 8

def initialize(site:, item:, section:)
  @site = site
  @item = item
  @section = section
  @url = Url.new(site: site, item: item)
end

Instance Attribute Details

#itemObject (readonly)

Returns the value of attribute item.



6
7
8
# File 'lib/jekyll/llms/entry.rb', line 6

def item
  @item
end

#sectionObject (readonly)

Returns the value of attribute section.



6
7
8
# File 'lib/jekyll/llms/entry.rb', line 6

def section
  @section
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/jekyll/llms/entry.rb', line 6

def url
  @url
end

Instance Method Details

#descriptionObject



15
16
17
# File 'lib/jekyll/llms/entry.rb', line 15

def description
  item.data.fetch("description", "").strip
end

#enabled?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/jekyll/llms/entry.rb', line 19

def enabled?
  item.data.fetch("llms", true)
end

#excluded_by?(patterns) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/jekyll/llms/entry.rb', line 27

def excluded_by?(patterns)
  patterns.any? do |pattern|
    url.matches?(pattern)
  end
end

#markdown_source?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/jekyll/llms/entry.rb', line 23

def markdown_source?
  markdown_extensions.include?(File.extname(item.relative_path).delete_prefix("."))
end

#titleObject



33
34
35
36
37
38
# File 'lib/jekyll/llms/entry.rb', line 33

def title
  title = item.data.fetch("title", "").strip
  return title unless title.empty?

  fallback_title
end