Class: Uniword::Batch::UpdateMetadataStage
- Inherits:
-
ProcessingStage
- Object
- ProcessingStage
- Uniword::Batch::UpdateMetadataStage
- Defined in:
- lib/uniword/batch/stages/update_metadata_stage.rb
Overview
Processing stage that updates document metadata.
Responsibility: Update document properties and metadata. Single Responsibility - only handles metadata updates.
Instance Attribute Summary
Attributes inherited from ProcessingStage
Instance Method Summary collapse
-
#description ⇒ String
Get stage description.
-
#initialize(options = {}) ⇒ UpdateMetadataStage
constructor
Initialize update metadata stage.
-
#process(document, context = {}) ⇒ Document
Process document to update metadata.
Methods inherited from ProcessingStage
Constructor Details
#initialize(options = {}) ⇒ UpdateMetadataStage
Initialize update metadata stage
27 28 29 30 31 32 33 34 35 |
# File 'lib/uniword/batch/stages/update_metadata_stage.rb', line 27 def initialize( = {}) super @update_author = .fetch(:update_author, true) @update_modified_date = .fetch(:update_modified_date, true) @update_revision_number = .fetch(:update_revision_number, true) @author = [:author] @company = [:company] @title = [:title] end |
Instance Method Details
#description ⇒ String
Get stage description
55 56 57 |
# File 'lib/uniword/batch/stages/update_metadata_stage.rb', line 55 def description "Update document metadata" end |
#process(document, context = {}) ⇒ Document
Process document to update metadata
42 43 44 45 46 47 48 49 50 |
# File 'lib/uniword/batch/stages/update_metadata_stage.rb', line 42 def process(document, context = {}) log "Updating metadata in #{context[:filename]}" update_core_properties(document) update_extended_properties(document) if @company log "Metadata update complete" document end |