Class: Lifer::Selection
- Inherits:
-
Collection
- Object
- Collection
- Lifer::Selection
- Defined in:
- lib/lifer/selection.rb
Overview
A selection is a group of entries that belong to any collection. Lifer includes some selection classes by default, but the intent here is to let users bring their own selections.
A selection subclass can be added to the Lifer project as a Ruby file. Any detected Ruby files are dynamically loaded when ‘Lifer::Brain` is initialized.
Implementing a selection is simple. Just implement the ‘#entries` method and rovide a name. The `#entries` method can be used to filter down `Lifer.entry_manifest` in whichever way one needs. To see examples of this, check out the source code of any of the included selections.
Direct Known Subclasses
Defined Under Namespace
Classes: AllMarkdown, IncludedInFeeds
Class Attribute Summary collapse
-
.name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Collection
Class Method Summary collapse
-
.generate ⇒ Lifer::Selection
The constructor method for selections.
Instance Method Summary collapse
-
#entries ⇒ Object
The ‘#entries` method should be implemented on every selection subclass.
-
#setting ⇒ String, ...
A getter for selection settings.
Methods inherited from Collection
Class Attribute Details
.name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/lifer/selection.rb', line 15 def name @name end |
Class Method Details
.generate ⇒ Lifer::Selection
The constructor method for selections. Unlike collections:
1. Selections never have a unique instance name. (There is only one
instance of each selection, and it's inherited from the class.)
2. Selections never have a directory. Selections are virtual,
pseudo-collections that paste together entries across collections.
Thus, the generator method here takes no arguments.
27 28 29 |
# File 'lib/lifer/selection.rb', line 27 def generate new(name: name, directory: nil) end |
Instance Method Details
#entries ⇒ Object
The ‘#entries` method should be implemented on every selection subclass.
47 48 49 |
# File 'lib/lifer/selection.rb', line 47 def entries raise NotImplementedError, I18n.t("selection.entries_not_implemented") end |
#setting ⇒ String, ...
A getter for selection settings. See ‘Lifer::Collection#setting` for more information.
60 61 62 |
# File 'lib/lifer/selection.rb', line 60 def setting(...) super(...) end |