Class: Alchemy::ElementsFinder
- Inherits:
-
Object
- Object
- Alchemy::ElementsFinder
- Defined in:
- lib/alchemy/elements_finder.rb
Overview
Loads elements from given page version.
Used by Page#find_elements and Alchemy::ElementsHelper#render_elements helper.
If you need custom element loading logic in your views you can create your own finder class and tell the Alchemy::ElementsHelper#render_elements helper or Page#find_elements to use that finder instead of this one.
Instance Method Summary collapse
- #elements(page_version:) ⇒ Alchemy::ElementsRepository
-
#initialize(options = {}) ⇒ ElementsFinder
constructor
A new instance of ElementsFinder.
Constructor Details
#initialize(options = {}) ⇒ ElementsFinder
Returns a new instance of ElementsFinder.
29 30 31 |
# File 'lib/alchemy/elements_finder.rb', line 29 def initialize( = {}) @options = end |
Instance Method Details
#elements(page_version:) ⇒ Alchemy::ElementsRepository
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/alchemy/elements_finder.rb', line 36 def elements(page_version:) elements = find_elements(page_version) if [:reverse] elements = elements.reverse end if [:random] elements = elements.random end elements.offset([:offset]).limit([:count]) end |