Module: Ronin::Support::Compression::Gzip
- Defined in:
- lib/ronin/support/compression/gzip.rb,
lib/ronin/support/compression/gzip/reader.rb,
lib/ronin/support/compression/gzip/writer.rb
Overview
Handles gzip compression/decompression.
Defined Under Namespace
Class Method Summary collapse
-
.new(io, mode: 'r') {|gz| ... } ⇒ Reader, Writer
Creates a gzip stream around the IO object.
-
.open(path, mode: 'r') {|gz| ... } ⇒ Reader, Writer
Opens a gzip file for reading or writing.
Class Method Details
.new(io, mode: 'r') {|gz| ... } ⇒ Reader, Writer
Creates a gzip stream around the IO object.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ronin/support/compression/gzip.rb', line 56 def self.new(io, mode: 'r', &block) gzip_class = if mode.include?('w') || mode.include?('a') Writer elsif mode.include?('r') Reader else raise(ArgumentError,"mode argument must include either 'r', 'w', or 'a': #{mode.inspect}") end return gzip_class.wrap(io,&block) end |
.open(path, mode: 'r') {|gz| ... } ⇒ Reader, Writer
Opens a gzip file for reading or writing.
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ronin/support/compression/gzip.rb', line 91 def self.open(path, mode: 'r', &block) gzip_class = if mode.include?('w') || mode.include?('a') Writer elsif mode.include?('r') Reader else raise(ArgumentError,"mode argument must include either 'r', 'w', or 'a'") end return gzip_class.open(path,&block) end |