In Files
Methods
Information
Class Index
![show/hide quicksearch [+]](../assets/icon/find.png)
- Ratch
- Ratch::Batch
- Ratch::CLI
- Ratch::ConfigUtils
- Ratch::Console
- Ratch::EmailUtils
- Ratch::Emailer
- Ratch::FTPUtils
- Ratch::FileList
- Ratch::FileNotFound
- Ratch::Help
- Ratch::POMUtils
- Ratch::RDocUtils
- Ratch::Script
- Ratch::Shell
- Ratch::System
- Ratch::TarUtils
- Ratch::XDGUtils
- Ratch::ZlibUtils
- FileTest
- Hash
- NilClass
- Object
- String
ZlibUtils
Public Class Methods
Public Instance Methods
gzip(file, tofile=nil, options={})
click to toggle source
Create a gzip file.
# File lib/ratch/utils/zlib.rb, line 16
16: def gzip(file, tofile=nil, options={})
17: noop, verbose = *util_options(options)
18:
19: tofile ||= File.basename(file) + '.gz'
20:
21: puts "gzip #{file}" if verbose
22:
23: file = localize(file)
24: tofile = localize(tofile)
25:
26: Zlib::GzipWriter.open(tofile) do |gz|
27: gz.write(File.read(file))
28: end unless noop
29:
30: return tofile
31: end
ungzip(file, options={})
click to toggle source
Unpack a gzip file.
# File lib/ratch/utils/zlib.rb, line 34
34: def ungzip(file, options={})
35: noop, verbose = *util_options(options)
36:
37: fname = File.basename(file).chomp(File.extname(file))
38:
39: puts "ungzip #{file}" if verbose
40:
41: fname = localize(fname)
42: file = localize(file)
43:
44: Zlib::GzipReader.open(file) do |gz|
45: File.open(fname, 'wb'){ |f| f << gz.read }
46: end unless noop
47:
48: return fname
49: end
Disabled; run with --debug to generate this.