Class: ActsAsCalculatorEditor::ExportTemplates

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_calculator_editor/export_templates.rb

Overview

The templates section — current versions only, and that is not a default anyone should switch off (docs/core-gem-contract.md §4.2, rule 2).

ImportTemplate publishes a new version for every entry it sees, in file order. Export the whole history and a re-import replays it in version order, ending with the highest version_number live. After a PromoteTemplate rollback the current version is not the highest-numbered one, so that replay quietly puts the rolled-back body back in production. Exporting what is live is both correct and what the import format means.

This is why full_history is a formula-versions switch and not a document-wide one: there is no version history to ask for here that could be re-imported truthfully.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key: nil, scope: nil) ⇒ ExportTemplates

Returns a new instance of ExportTemplates.



20
21
22
23
# File 'lib/acts_as_calculator_editor/export_templates.rb', line 20

def initialize(key: nil, scope: nil)
  @key = key
  @scope = scope
end

Class Method Details

.callObject



16
17
18
# File 'lib/acts_as_calculator_editor/export_templates.rb', line 16

def self.call(...)
  new(...).call
end

Instance Method Details

#callObject



25
26
27
# File 'lib/acts_as_calculator_editor/export_templates.rb', line 25

def call
  templates.map { |template| entry(template) }
end