aboutsummaryrefslogtreecommitdiffstats
path: root/lib/roo/open_office.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/roo/open_office.rb')
-rw-r--r--lib/roo/open_office.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/roo/open_office.rb b/lib/roo/open_office.rb
index 6ccbe85..f172363 100644
--- a/lib/roo/open_office.rb
+++ b/lib/roo/open_office.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'date'
require 'nokogiri'
require 'cgi'
@@ -11,9 +13,9 @@ module Roo
class OpenOffice < Roo::Base
extend Roo::Tempdir
- ERROR_MISSING_CONTENT_XML = 'file missing required content.xml'.freeze
- XPATH_FIND_TABLE_STYLES = "//*[local-name()='automatic-styles']".freeze
- XPATH_LOCAL_NAME_TABLE = "//*[local-name()='table']".freeze
+ ERROR_MISSING_CONTENT_XML = 'file missing required content.xml'
+ XPATH_FIND_TABLE_STYLES = "//*[local-name()='automatic-styles']"
+ XPATH_LOCAL_NAME_TABLE = "//*[local-name()='table']"
# initialization and opening of a spreadsheet file
# values for packed: :zip
@@ -561,7 +563,7 @@ module Roo
end
def read_labels
- @label ||= Hash[doc.xpath('//table:named-range').map do |ne|
+ @label ||= doc.xpath('//table:named-range').each_with_object({}) do |ne, hash|
#-
# $Sheet1.$C$5
#+
@@ -569,8 +571,8 @@ module Roo
sheetname, coords = attribute(ne, 'cell-range-address').to_s.split('.$')
col, row = coords.split('$')
sheetname = sheetname[1..-1] if sheetname[0, 1] == '$'
- [name, [sheetname, row, col]]
- end]
+ hash[name] = [sheetname, row, col]
+ end
end
def read_styles(style_elements)