Sha256: d7ede0c540179f86dd5ffd973a045406367041f8a748da030c7b6f1e88fff4e6

Contents?: true

Size: 512 Bytes

Versions: 3

Compression:

Stored size: 512 Bytes

Contents

require 'roo/excelx/extractor'

module Roo
  class Excelx::Comments < Excelx::Extractor

    def comments
      @comments ||= extract_comments
    end

    private

    def extract_comments
      if doc_exists?
        Hash[doc.xpath("//comments/commentList/comment").map do |comment|
          value = (comment.at_xpath('./text/r/t') || comment.at_xpath('./text/t')).text
          [::Roo::Utils.ref_to_key(comment.attributes['ref'].to_s), value]
        end]
      else
        {}
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
culturecode-roo-2.0.2 lib/roo/excelx/comments.rb
roo-2.0.0 lib/roo/excelx/comments.rb
roo-2.0.0beta1 lib/roo/excelx/comments.rb