Module: Omnizip::Formats::Ole
- Defined in:
- lib/omnizip/formats/ole.rb,
lib/omnizip/formats/ole/dirent.rb,
lib/omnizip/formats/ole/header.rb,
lib/omnizip/formats/ole/storage.rb,
lib/omnizip/formats/ole/constants.rb,
lib/omnizip/formats/ole/ranges_io.rb,
lib/omnizip/formats/ole/types/variant.rb,
lib/omnizip/formats/ole/allocation_table.rb
Overview
OLE compound document format support
Provides read access to Microsoft OLE compound documents, commonly used for .doc, .xls, .ppt files and MSI installers.
Defined Under Namespace
Modules: Constants, Types Classes: AllocationTable, Dirent, Header, RangesIO, RangesIOMigrateable, RangesIOResizeable, Storage
Class Method Summary collapse
-
.directory?(ole_path, entry_path) ⇒ Boolean
Check if entry is a directory (storage).
-
.exist?(ole_path, entry_path) ⇒ Boolean
Check if entry exists in OLE file.
-
.extract(ole_path, output_dir) ⇒ Object
Extract all streams to directory.
-
.file?(ole_path, entry_path) ⇒ Boolean
Check if entry is a file (stream).
-
.info(ole_path, entry_path = "/") ⇒ Hash?
Get info about entry in OLE file.
-
.list(path, dir_path = "/") ⇒ Array<String>
List entries in OLE file.
-
.open(path) {|Storage| ... } ⇒ Storage
Open OLE file.
-
.read(ole_path, stream_path) ⇒ String
Read stream from OLE file.
Class Method Details
.directory?(ole_path, entry_path) ⇒ Boolean
Check if entry is a directory (storage)
108 109 110 |
# File 'lib/omnizip/formats/ole.rb', line 108 def directory?(ole_path, entry_path) self.open(ole_path) { |ole| ole.directory?(entry_path) } end |
.exist?(ole_path, entry_path) ⇒ Boolean
Check if entry exists in OLE file
90 91 92 |
# File 'lib/omnizip/formats/ole.rb', line 90 def exist?(ole_path, entry_path) self.open(ole_path) { |ole| ole.exist?(entry_path) } end |
.extract(ole_path, output_dir) ⇒ Object
Extract all streams to directory
116 117 118 119 120 |
# File 'lib/omnizip/formats/ole.rb', line 116 def extract(ole_path, output_dir) self.open(ole_path) do |ole| extract_dirent(ole.root, output_dir, ole) end end |
.file?(ole_path, entry_path) ⇒ Boolean
Check if entry is a file (stream)
99 100 101 |
# File 'lib/omnizip/formats/ole.rb', line 99 def file?(ole_path, entry_path) self.open(ole_path) { |ole| ole.file?(entry_path) } end |
.info(ole_path, entry_path = "/") ⇒ Hash?
Get info about entry in OLE file
81 82 83 |
# File 'lib/omnizip/formats/ole.rb', line 81 def info(ole_path, entry_path = "/") self.open(ole_path) { |ole| ole.info(entry_path) } end |
.list(path, dir_path = "/") ⇒ Array<String>
List entries in OLE file
63 64 65 |
# File 'lib/omnizip/formats/ole.rb', line 63 def list(path, dir_path = "/") self.open(path) { |ole| ole.list(dir_path) } end |
.open(path) {|Storage| ... } ⇒ Storage
Open OLE file
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/omnizip/formats/ole.rb', line 45 def open(path) storage = Storage.open(path) if block_given? begin yield storage ensure storage.close end else storage end end |
.read(ole_path, stream_path) ⇒ String
Read stream from OLE file
72 73 74 |
# File 'lib/omnizip/formats/ole.rb', line 72 def read(ole_path, stream_path) self.open(ole_path) { |ole| ole.read(stream_path) } end |