Sha256: ab3183b78f89f734c18db6a819bda78d3edaf41610270e6d2a4c2e9a1ef76d45
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
# frozen_string_literal: true module Goldendocx module Parts class Core include Goldendocx::Document TYPE = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties' XML_PATH = 'docProps/core.xml' NAMESPACE = 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties' CONTENT_TYPE = 'application/vnd.openxmlformats-package.core-properties+xml' concern_namespaces :cp, :dc, :dcterms, :dcmitype, :xsi namespace :cp tag :coreProperties embeds_one :creator, class_name: 'Goldendocx::Parts::Properties::CreatorProperty' embeds_one :created_at, class_name: 'Goldendocx::Parts::Properties::CreatedAtProperty' embeds_one :revision, class_name: 'Goldendocx::Parts::Properties::RevisionProperty' embeds_one :updater, class_name: 'Goldendocx::Parts::Properties::UpdaterProperty' embeds_one :updated_at, class_name: 'Goldendocx::Parts::Properties::UpdatedAtProperty' class << self def read_from(xml_node) core = super(xml_node) revision = (core.revision || core.build_revision) revision.value = revision.value.to_i + 1 core.build_updater(name: "Goldendocx_#{Goldendocx::VERSION}") core.build_updated_at(timestamp: Time.now) core end end def initialize build_creator(name: "Goldendocx_#{Goldendocx::VERSION}") build_created_at(timestamp: Time.now) end def write_to(zos) zos.put_next_entry XML_PATH zos.write to_document_xml end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
goldendocx-0.3.0 | lib/goldendocx/parts/core.rb |
goldendocx-0.2.3 | lib/goldendocx/parts/core.rb |