diff options
| author | 2019-01-14 01:41:26 -0500 | |
|---|---|---|
| committer | 2019-01-14 01:41:26 -0500 | |
| commit | 6aa7e04e06423e7d92ede727489ea346e88f7108 (patch) | |
| tree | 9bdec92fd17898b662235bc0a491de827990130c /lib/roo/excelx/images.rb | |
| parent | c59817e300dbe1aab3120cad603cdb14b14ed78b (diff) | |
| parent | dddfa903d2b856146f05ffb4415c31d6127bb5bf (diff) | |
Update upstream source from tag 'upstream/2.8.0'
Update to upstream version '2.8.0'
with Debian dir 569f5866fbcf4e449c6c48dc5d20a3ab54f95252
Diffstat (limited to 'lib/roo/excelx/images.rb')
| -rw-r--r-- | lib/roo/excelx/images.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/roo/excelx/images.rb b/lib/roo/excelx/images.rb new file mode 100644 index 0000000..cf0221f --- /dev/null +++ b/lib/roo/excelx/images.rb @@ -0,0 +1,26 @@ +require 'roo/excelx/extractor' + +module Roo + class Excelx + class Images < Excelx::Extractor + + # Returns: Hash { id1: extracted_file_name1 }, + # Example: { "rId1"=>"roo_media_image1.png", + # "rId2"=>"roo_media_image2.png", + # "rId3"=>"roo_media_image3.png" } + def list + @images ||= extract_images_names + end + + private + + def extract_images_names + return {} unless doc_exists? + + doc.xpath('/Relationships/Relationship').each_with_object({}) do |rel, hash| + hash[rel['Id']] = "roo" + rel['Target'].gsub(/\.\.\/|\//, '_') + end + end + end + end +end |
