renc 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/bin/console +0 -0
- data/lib/renc.rb +4 -10
- data/lib/renc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23dd022e00e54050a4613a1aae4999e49046876
|
4
|
+
data.tar.gz: 5e0c6ca26059dcfaa1c52ff9f522a5e3bb35362d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bd1436484490cf7f116aad27f3b7eb044292148857f11b6956e7369822f4ec3aa708d2dd9ad100252964ca05c01108723b971eb5c33ac7862ad0f1301e7f703
|
7
|
+
data.tar.gz: 7424d0ddbcd033c1416a01d34bb39db2dc4a98b222fead380395cc1d9d44f3c89b4897ee9f7610f4db2d919be9fae0de65c9c58597c5a7300ef3cc889076e70e
|
data/CHANGELOG.md
CHANGED
data/bin/console
CHANGED
File without changes
|
data/lib/renc.rb
CHANGED
@@ -20,28 +20,23 @@ require 'renc/version'
|
|
20
20
|
# # or context `main`
|
21
21
|
# extend Renc
|
22
22
|
module Renc
|
23
|
+
TARGET_CLASS = [String, Array, Hash].freeze
|
23
24
|
# include #renc method
|
24
|
-
|
25
|
+
TARGET_CLASS.each { |klass| klass.include self }
|
25
26
|
|
26
27
|
# recurse encoding for Hash and Array.
|
27
|
-
# @param obj [Object]
|
28
28
|
# @param encoding [Encoding]
|
29
|
+
# @param obj [Object]
|
29
30
|
# @return [Object]
|
30
31
|
def renc(encoding = Encoding::UTF_8, obj = self)
|
31
|
-
# binding.pry
|
32
32
|
case obj
|
33
33
|
when String then obj.encode(encoding)
|
34
|
-
when Hash then renc_hash(obj, encoding)
|
35
34
|
when Array then renc_array(obj, encoding)
|
35
|
+
when Hash then renc_hash(obj, encoding)
|
36
36
|
else obj
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
# @see #renc
|
41
|
-
alias enc renc
|
42
|
-
extend Gem::Deprecate
|
43
|
-
deprecate :enc, :renc, 2016, 3
|
44
|
-
|
45
40
|
private
|
46
41
|
|
47
42
|
# recurse encoding for Hash values of String.
|
@@ -49,7 +44,6 @@ module Renc
|
|
49
44
|
obj.each_with_object({}) do |args, h|
|
50
45
|
key, val = args
|
51
46
|
h[key] = renc(encoding, val)
|
52
|
-
# h[key] = val.renc(encoding)
|
53
47
|
end
|
54
48
|
end
|
55
49
|
|
data/lib/renc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k-ta-yamada
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.5.1
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: recurse encoding for Hash and Array.
|