Sha256: 0826403a44e5096828dc8079691489c2dd7b0404ecd1fd8943bb83d14b683f1e

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

module RubyXL
  module Writer
    class CoreWriter < GenericWriter

      def filepath
        File.join('docProps', 'core.xml')
      end

      def write()
        render_xml do |xml|
          xml << (xml.create_element('cp:coreProperties', 
                     'xmlns:cp' => 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
                     'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
                     'xmlns:dcterms' => 'http://purl.org/dc/terms/',
                     'xmlns:dcmitype' => 'http://purl.org/dc/dcmitype/',
                     'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') { |root|

            root << xml.create_element('dc:creator',        @workbook.creator)
            root << xml.create_element('cp:lastModifiedBy', @workbook.modifier)

            unless @workbook.created_at.to_s.empty?
              root << xml.create_element('dcterms:created',  { 'xsi:type' => 'dcterms:W3CDTF' }, @workbook.created_at)
            end

            unless @workbook.modified_at.to_s.empty?
              root << xml.create_element('dcterms:modified', { 'xsi:type' => 'dcterms:W3CDTF' }, @workbook.modified_at)
            end
          })
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rubyXL-git-ref-6002046-2.0.0 lib/rubyXL/writer/core_writer.rb
rubyXL-2.3.4 lib/rubyXL/writer/core_writer.rb
rubyXL-2.3.3 lib/rubyXL/writer/core_writer.rb
rubyXL-2.3.2 lib/rubyXL/writer/core_writer.rb
rubyXL-2.3.1 lib/rubyXL/writer/core_writer.rb
rubyXL-2.3.0 lib/rubyXL/writer/core_writer.rb
rubyXL-2.2.0 lib/rubyXL/writer/core_writer.rb
rubyXL-2.1.1 lib/rubyXL/writer/core_writer.rb