Class: SafeZip::Extract
- Inherits:
-
Object
- Object
- SafeZip::Extract
- Defined in:
- lib/safe_zip/extract.rb
Overview
SafeZip::Extract provides a safe interface to extract specific directories or files within a ‘zip` archive.
Constant Summary collapse
- Error =
Class.new(StandardError)
- PermissionDeniedError =
Class.new(Error)
- SymlinkSourceDoesNotExistError =
Class.new(Error)
- UnsupportedEntryError =
Class.new(Error)
- EntrySizeError =
Class.new(Error)
- AlreadyExistsError =
Class.new(Error)
- NoMatchingError =
Class.new(Error)
- ExtractError =
Class.new(Error)
Instance Attribute Summary collapse
-
#archive_path ⇒ Object
readonly
Returns the value of attribute archive_path.
Instance Method Summary collapse
-
#extract(opts = {}) ⇒ Object
extract given files or directories from the archive into the destination path.
-
#initialize(archive_file) ⇒ Extract
constructor
A new instance of Extract.
Constructor Details
#initialize(archive_file) ⇒ Extract
Returns a new instance of Extract.
23 24 25 |
# File 'lib/safe_zip/extract.rb', line 23 def initialize(archive_file) @archive_path = archive_file end |
Instance Attribute Details
#archive_path ⇒ Object (readonly)
Returns the value of attribute archive_path.
21 22 23 |
# File 'lib/safe_zip/extract.rb', line 21 def archive_path @archive_path end |
Instance Method Details
#extract(opts = {}) ⇒ Object
extract given files or directories from the archive into the destination path
41 42 43 44 45 |
# File 'lib/safe_zip/extract.rb', line 41 def extract(opts = {}) params = SafeZip::ExtractParams.new(**opts) extract_with_ruby_zip(params) end |