Class: Alchemy::Page::EtagGenerator
- Inherits:
-
Object
- Object
- Alchemy::Page::EtagGenerator
- Defined in:
- app/models/alchemy/page/etag_generator.rb
Overview
Generates an ETag for a page.
By default, it uses the page’s id and the ids of its published elements. You can customize this by providing your own generator in the configuration.
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
- #call(*args) ⇒ Array<Object>
-
#initialize(page) ⇒ EtagGenerator
constructor
A new instance of EtagGenerator.
Constructor Details
#initialize(page) ⇒ EtagGenerator
Returns a new instance of EtagGenerator.
10 11 12 |
# File 'app/models/alchemy/page/etag_generator.rb', line 10 def initialize(page) @page = page end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
7 8 9 |
# File 'app/models/alchemy/page/etag_generator.rb', line 7 def page @page end |
Instance Method Details
#call(*args) ⇒ Array<Object>
16 17 18 19 |
# File 'app/models/alchemy/page/etag_generator.rb', line 16 def call(*args) elements_cache_key = page.public_version&.elements&.published&.order(:id)&.pluck(:id) [page, elements_cache_key, *args] end |