Class: ActsAsCalculatorEditor::BuildExportDocument
- Inherits:
-
Object
- Object
- ActsAsCalculatorEditor::BuildExportDocument
- Defined in:
- lib/acts_as_calculator_editor/build_export_document.rb
Overview
A document ActsAsCalculator::ImportDefinitions can read back, section for section.
Section order matches ImportDefinitions::SECTIONS and is not arbitrary: a formula
variable with source_type: "lookup" cannot resolve until its table exists, so
lookup_tables has to be applied first. Ruby hashes keep insertion order and so does
to_json, which is the whole mechanism keeping that promise.
The default is what is live, not what has ever been. Active formula versions and
current template versions only. A full-history export of a long-lived formula is mostly
a re-creation of history nobody will consult, and for templates it is actively wrong
(see ExportTemplates). full_history: true widens the formulas section to every
version, in the order a re-import has to apply them; nothing widens the templates one.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(key: nil, scope: nil, full_history: false) ⇒ BuildExportDocument
constructor
A new instance of BuildExportDocument.
Constructor Details
#initialize(key: nil, scope: nil, full_history: false) ⇒ BuildExportDocument
Returns a new instance of BuildExportDocument.
21 22 23 24 25 |
# File 'lib/acts_as_calculator_editor/build_export_document.rb', line 21 def initialize(key: nil, scope: nil, full_history: false) @key = key.presence @scope = scope.presence @full_history = full_history end |
Class Method Details
.call ⇒ Object
17 18 19 |
# File 'lib/acts_as_calculator_editor/build_export_document.rb', line 17 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 |
# File 'lib/acts_as_calculator_editor/build_export_document.rb', line 27 def call { "lookup_tables" => ExportLookupTables.(key:, scope:), "formulas" => ExportFormulas.(key:, scope:, full_history:), "templates" => ExportTemplates.(key:, scope:) } end |