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
-
#created ⇒ Object
Creation time of the document.
-
#creator ⇒ String
The author of the document.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Core
constructor
Creates a new Core object.
-
#to_xml_string(str = '') ⇒ String
serializes the core.xml document.
Constructor Details
#initialize(options = {}) ⇒ Core
Creates a new Core object.
12 13 14 15 |
# File 'lib/axlsx/doc_props/core.rb', line 12 def initialize(={}) @creator = [:creator] || 'axlsx' @created = [:created] end |
Instance Attribute Details
#created ⇒ Object
Creation time of the document. If nil, the current time will be used.
22 23 24 |
# File 'lib/axlsx/doc_props/core.rb', line 22 def created @created end |
#creator ⇒ String
The author of the document. By default this is 'axlsx'
19 20 21 |
# File 'lib/axlsx/doc_props/core.rb', line 19 def creator @creator end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
serializes the core.xml document
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/axlsx/doc_props/core.rb', line 26 def to_xml_string(str = '') str << '<?xml version="1.0" encoding="UTF-8"?>' str << ('<cp:coreProperties xmlns:cp="' << CORE_NS << '" xmlns:dc="' << CORE_NS_DC << '" ') str << ('xmlns:dcmitype="' << CORE_NS_DCMIT << '" xmlns:dcterms="' << CORE_NS_DCT << '" ') str << ('xmlns:xsi="' << CORE_NS_XSI << '">') str << ('<dc:creator>' << self.creator << '</dc:creator>') str << ('<dcterms:created xsi:type="dcterms:W3CDTF">' << (created || Time.now).strftime('%Y-%m-%dT%H:%M:%S') << 'Z</dcterms:created>') str << '<cp:revision>0</cp:revision>' str << '</cp:coreProperties>' end |