Class: Axlsx::Core
- Inherits:
-
Object
- Object
- Axlsx::Core
- Defined in:
- lib/axlsx/doc_props/core.rb
Overview
Note:
Packages manage their own core object.
The core object for the package.
Instance Attribute Summary collapse
-
#creator ⇒ String
The author of the document.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Core
constructor
Creates a new Core object.
-
#to_xml ⇒ String
Serializes the core object.
Constructor Details
#initialize(options = {}) ⇒ Core
Creates a new Core object.
12 13 14 |
# File 'lib/axlsx/doc_props/core.rb', line 12 def initialize(={}) @creator = [:creator] || 'axlsx' end |
Instance Attribute Details
#creator ⇒ String
The author of the document. By default this is ‘axlsx’
8 9 10 |
# File 'lib/axlsx/doc_props/core.rb', line 8 def creator @creator end |
Instance Method Details
#to_xml ⇒ String
Serializes the core object. The created dcterms item is set to the current time when this method is called.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/axlsx/doc_props/core.rb', line 18 def to_xml() builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml| xml.send('cp:coreProperties', :"xmlns:cp" => CORE_NS, :'xmlns:dc' => CORE_NS_DC, :'xmlns:dcmitype'=>CORE_NS_DCMIT, :'xmlns:dcterms'=>CORE_NS_DCT, :'xmlns:xsi'=>CORE_NS_XSI) { xml['dc'].creator self.creator xml['dcterms'].created Time.now.strftime('%Y-%m-%dT%H:%M:%S'), :'xsi:type'=>"dcterms:W3CDTF" xml['cp'].revision 0 } end builder.to_xml end |