Class: Lifer::Builder::HTML::FromLiquid::Drops::EntryDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/lifer/builder/html/from_liquid/drops/entry_drop.rb

Overview

This drop represents a Lifer entry and allows users to access entry metadata and content in Liquid templates.

Examples:

Usage

<h1>{{ entry.title }}</h1>
<small>
  Published on <datetime>{{ entry.published_at }}</datetime>
</small>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lifer_entry, collection:, tags:) ⇒ EntryDrop

Returns a new instance of EntryDrop.



14
15
16
17
18
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 14

def initialize(lifer_entry, collection:, tags:)
  @lifer_entry = lifer_entry
  @collection = collection
  @tags = tags
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



12
13
14
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 12

def collection
  @collection
end

#lifer_entryObject

Returns the value of attribute lifer_entry.



12
13
14
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 12

def lifer_entry
  @lifer_entry
end

Instance Method Details

#authorString

The entry author (or authors).

Returns:

  • (String)


23
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 23

def author = authors

#authorsString

The entry authors (or author).

Returns:

  • (String)


28
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 28

def authors = (@authors ||= lifer_entry.authors.join(", "))

#contentString

The entry content.

Returns:

  • (String)


33
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 33

def content = (@content ||= lifer_entry.to_html)

#frontmatterFrontmatterDrop

The entry frontmatter data.

Returns:



38
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 38

def frontmatter = (@frontmatter ||= FrontmatterDrop.new(lifer_entry))

#pathString

The path to the entry.

Returns:

  • (String)

    The path to the entry.



43
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 43

def path = (@path ||= lifer_entry.path)

The entry permalink.

Returns:

  • (String)

    The entry permalink.



48
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 48

def permalink = (@permalink ||= lifer_entry.permalink)

#published_atString

The entry publication date (as a string).

Returns:

  • (String)


53
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 53

def published_at = (@published_at ||= lifer_entry.published_at)

#summaryString

The summary of the entry.

Returns:

  • (String)

    The summary of the entry.



58
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 58

def summary = (@summary ||= lifer_entry.summary)

#titleString

The entry title.

Returns:

  • (String)

    The entry title.



63
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 63

def title = (@title ||= lifer_entry.title)

#updated_atString

The entry’s last updated date (as a string).

Returns:

  • (String)


68
# File 'lib/lifer/builder/html/from_liquid/drops/entry_drop.rb', line 68

def updated_at = (@updated_at ||= lifer_entry.updated_at)