diff options
| author | 2019-01-14 01:40:56 -0500 | |
|---|---|---|
| committer | 2019-01-14 01:40:56 -0500 | |
| commit | dddfa903d2b856146f05ffb4415c31d6127bb5bf (patch) | |
| tree | e38c2aca92b54f06ccd0185f48dc47e3e1b3d77e /lib/roo/excelx/extractor.rb | |
| parent | 8280a21a23d44aa90177e2bc041d0b8dc8556f4b (diff) | |
New upstream version 2.8.0upstream/2.8.0
Diffstat (limited to 'lib/roo/excelx/extractor.rb')
| -rwxr-xr-x[-rw-r--r--] | lib/roo/excelx/extractor.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/roo/excelx/extractor.rb b/lib/roo/excelx/extractor.rb index 1cdd13b..b87a84e 100644..100755 --- a/lib/roo/excelx/extractor.rb +++ b/lib/roo/excelx/extractor.rb @@ -1,16 +1,34 @@ +# frozen_string_literal: true + +require "roo/helpers/weak_instance_cache" + module Roo class Excelx class Extractor - def initialize(path) + include Roo::Helpers::WeakInstanceCache + + COMMON_STRINGS = { + t: "t", + r: "r", + s: "s", + ref: "ref", + html_tag_open: "<html>", + html_tag_closed: "</html>" + } + + def initialize(path, options = {}) @path = path + @options = options end private def doc - raise FileNotFound, "#{@path} file not found" unless doc_exists? + instance_cache(:@doc) do + raise FileNotFound, "#{@path} file not found" unless doc_exists? - ::Roo::Utils.load_xml(@path).remove_namespaces! + ::Roo::Utils.load_xml(@path).remove_namespaces! + end end def doc_exists? |
