easy_zip 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/easy_zip.rb +20 -0
- data/lib/easy_zip/strings.rb +28 -0
- data/lib/easy_zip/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee8cecdbcc48ec8d5853b8cdbcff446448e4d256
|
4
|
+
data.tar.gz: 4e7dc88a74b1cf3f76b93095c20e3f319f276828
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d92b68f4819cd6ff41ca2828f86cd03ceca245e88efc68e45e46452ba6967663e43a2f70bba013bbcd76b9b07d4551044d81624ea6c23434c21bcdbc364520f7
|
7
|
+
data.tar.gz: 69ad2afbf3fc7f2e788c02deb0e5282d9e7151338bd0b1962d043b522f3f0af0fdbc37570a7e81acce19b882c974d3f51604fddc2909ee2bb1afa8d25f360d0f
|
data/README.md
CHANGED
@@ -30,6 +30,11 @@ EasyZip::Gzip.read_lines('read gzip filepath')
|
|
30
30
|
EasyZip::Gzip.write_lines('write gzip filepath', 'write value')
|
31
31
|
# write lines to gzip.
|
32
32
|
EasyZip::Gzip.write_lines('write gzip filepath', ['first', 'second', 'third'])
|
33
|
+
|
34
|
+
# compress string.
|
35
|
+
EasyZip::Gzip.compress('target string')
|
36
|
+
# decompress string.
|
37
|
+
EasyZip::Gzip.decompress('target string')
|
33
38
|
```
|
34
39
|
|
35
40
|
## Development
|
data/lib/easy_zip.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "easy_zip/version"
|
2
2
|
require "easy_zip/file"
|
3
|
+
require "easy_zip/strings"
|
3
4
|
|
4
5
|
# easy zip module.
|
5
6
|
module EasyZip
|
@@ -22,5 +23,24 @@ module EasyZip
|
|
22
23
|
|
23
24
|
EasyZip::File.write_lines(filepath, values)
|
24
25
|
end
|
26
|
+
|
27
|
+
# compress string.
|
28
|
+
# @param [String] str compress string.
|
29
|
+
# @param [Integer] level compress level. reference Zlib.
|
30
|
+
# @return [String] compress string.
|
31
|
+
def self.compress(str, level = Zlib::BEST_SPEED)
|
32
|
+
|
33
|
+
# compress string.
|
34
|
+
EasyZip::Strings.compress(str, level)
|
35
|
+
end
|
36
|
+
|
37
|
+
# decompress string.
|
38
|
+
# @param [String] str decompress string.
|
39
|
+
# @return [String] decompress string.
|
40
|
+
def self.decompress(str)
|
41
|
+
|
42
|
+
# decompress string.
|
43
|
+
EasyZip::Strings.decompress(str)
|
44
|
+
end
|
25
45
|
end
|
26
46
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'zlib'
|
2
|
+
|
3
|
+
# easy zip module.
|
4
|
+
module EasyZip
|
5
|
+
|
6
|
+
# Strings class
|
7
|
+
class Strings
|
8
|
+
|
9
|
+
# compress string.
|
10
|
+
# @param [String] str compress string.
|
11
|
+
# @param [Integer] level compress level. reference Zlib.
|
12
|
+
# @return [String] compress string.
|
13
|
+
def self.compress(str, level = Zlib::BEST_SPEED)
|
14
|
+
|
15
|
+
# compress string.
|
16
|
+
Zlib::Deflate.deflate(str, level)
|
17
|
+
end
|
18
|
+
|
19
|
+
# decompress string.
|
20
|
+
# @param [String] str decompress string.
|
21
|
+
# @return [String] decompress string.
|
22
|
+
def self.decompress(str)
|
23
|
+
|
24
|
+
# decompress string.
|
25
|
+
Zlib::Inflate.inflate(str)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/easy_zip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_zip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- h.shigemoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- easy_zip.gemspec
|
74
74
|
- lib/easy_zip.rb
|
75
75
|
- lib/easy_zip/file.rb
|
76
|
+
- lib/easy_zip/strings.rb
|
76
77
|
- lib/easy_zip/version.rb
|
77
78
|
homepage: https://github.com/koyupi/easy_zip
|
78
79
|
licenses:
|