gzip 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +10 -0
- data/lib/gzip.rb +28 -0
- metadata +70 -0
data/README
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
zipping made easy
|
2
|
+
|
3
|
+
Cranial Load == CRANIAL_LOAD_MINIMUM => true
|
4
|
+
|
5
|
+
require 'gzip'
|
6
|
+
a = "hello".gzip # => "\x1F\x8B\b\x00\xA4w\xD1M\x00\x03\xCBH\xCD\xC9\xC9\a\x00\x86\xA6\x106\x05\x00\x00\x00"
|
7
|
+
b = a.gunzip
|
8
|
+
b == "hello" # => true
|
9
|
+
#useful for bigger strings, "hello" does not compress well
|
10
|
+
a = ("a" * 100).gzip # => "\x1F\x8B\b\x00\xD9w\xD1M\x00\x03KL\xA4=\x00\x00dzp\xAFd\x00\x00\x00"
|
data/lib/gzip.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'zlib'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
class String
|
5
|
+
def gzip
|
6
|
+
if self.length > 0 then
|
7
|
+
zdata = "";sio = StringIO.new(zdata)
|
8
|
+
gz = Zlib::GzipWriter.new(sio)
|
9
|
+
gz.write(self)
|
10
|
+
gz.close
|
11
|
+
zdata
|
12
|
+
else
|
13
|
+
""
|
14
|
+
end
|
15
|
+
end
|
16
|
+
def gunzip
|
17
|
+
if self.length > 0 then
|
18
|
+
sio = StringIO.new(self)
|
19
|
+
gz = Zlib::GzipReader.new(sio)
|
20
|
+
string = gz.read
|
21
|
+
gz.close
|
22
|
+
string
|
23
|
+
else
|
24
|
+
""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gzip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: "1.0"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Branden Giacoletto
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-05-16 00:00:00 -06:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Zipping should be easy, everybody does it (or wants to) but yet they make it so draw out. Now you can do it too. "hello".gzip.
|
22
|
+
email:
|
23
|
+
- branden@carbondatacomputers.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/gzip.rb
|
32
|
+
- README
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://JockOfCode.com/gzip
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 3
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
version: "0"
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 23
|
57
|
+
segments:
|
58
|
+
- 1
|
59
|
+
- 3
|
60
|
+
- 6
|
61
|
+
version: 1.3.6
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: file_resources_manager
|
65
|
+
rubygems_version: 1.6.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: "\"hello world\".gzip => Done"
|
69
|
+
test_files: []
|
70
|
+
|