Class: Clickwrap::Services::PublishDocuments
- Inherits:
-
Object
- Object
- Clickwrap::Services::PublishDocuments
- Defined in:
- lib/clickwrap/services/publish_documents.rb
Overview
bin/rails clickwrap:publish — reads the declared document bytes once,
digests them, and freezes a database snapshot.
After this runs, the snapshot is the evidence and the file on disk is only where it came from. Editing the file changes nothing about what was already published, which is exactly the property a receipt from three years ago depends on.
The task is idempotent: re-publishing identical bytes under the same label is a no-op. Re-publishing different bytes under the same label is refused, because a version label that can mean two different documents is not a version label.
Defined Under Namespace
Classes: Outcome
Instance Attribute Summary collapse
-
#definitions ⇒ Object
readonly
Returns the value of attribute definitions.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
Instance Method Summary collapse
- #call ⇒ Object (also: #plan)
-
#initialize(dry_run: false, definitions: nil) ⇒ PublishDocuments
constructor
A new instance of PublishDocuments.
Constructor Details
#initialize(dry_run: false, definitions: nil) ⇒ PublishDocuments
Returns a new instance of PublishDocuments.
24 25 26 27 |
# File 'lib/clickwrap/services/publish_documents.rb', line 24 def initialize(dry_run: false, definitions: nil) @dry_run = dry_run @definitions = definitions || Clickwrap.documents.values end |
Instance Attribute Details
#definitions ⇒ Object (readonly)
Returns the value of attribute definitions.
29 30 31 |
# File 'lib/clickwrap/services/publish_documents.rb', line 29 def definitions @definitions end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
29 30 31 |
# File 'lib/clickwrap/services/publish_documents.rb', line 29 def dry_run @dry_run end |
Instance Method Details
#call ⇒ Object Also known as: plan
31 32 33 |
# File 'lib/clickwrap/services/publish_documents.rb', line 31 def call definitions.map { |definition| publish(definition) } end |