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
# File 'lib/jekyll/llms/entry.rb', line 8

def initialize(site:, item:, section:)
  @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



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

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

#enabled?Boolean

Returns:

  • (Boolean)


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

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

#excluded_by?(patterns) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#titleObject



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

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

  fallback_title
end