Class: Omnizip::ArchiveHandlers::OleHandler
- Inherits:
-
Object
- Object
- Omnizip::ArchiveHandlers::OleHandler
- Defined in:
- lib/omnizip/archive_handlers/ole_handler.rb
Overview
Read-only adapter for OLE compound documents ( MSI installers, legacy Office binaries): stream listing, reading, and extraction. Stream names are listed exactly as stored — MSI installers mangle their table-stream names in a MSI-domain encoding this handler does not decode.
Instance Method Summary collapse
- #create(_path, **_options) ⇒ Object
- #extract_to(path, output_dir, **_) ⇒ Object
- #list(path, details: false, **_) ⇒ Object
- #read_entry(path, entry_name, **_) ⇒ Object
Instance Method Details
#create(_path, **_options) ⇒ Object
11 12 13 14 15 |
# File 'lib/omnizip/archive_handlers/ole_handler.rb', line 11 def create(_path, **) raise Omnizip::UnsupportedFormatError, "compound documents cannot be created through the " \ "convenience API; use Omnizip::Formats::Ole directly" end |
#extract_to(path, output_dir, **_) ⇒ Object
17 18 19 20 21 |
# File 'lib/omnizip/archive_handlers/ole_handler.rb', line 17 def extract_to(path, output_dir, **_) Omnizip::Formats::Ole.extract(path, output_dir) Dir.glob(File.join(output_dir, "**", "*")) .select { |f| File.file?(f) } end |
#list(path, details: false, **_) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/omnizip/archive_handlers/ole_handler.rb', line 23 def list(path, details: false, **_) entries = Omnizip::Formats::Ole.list(path) return entries unless details entries.map { |name| { name: name, size: nil, directory: false } } end |