valuables 0.1.0 → 0.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 +9 -0
- data/lib/valuables/deep_freeze.rb +6 -5
- data/lib/valuables/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: 45335de460564531a2dcb8df1a76e94925230148
|
4
|
+
data.tar.gz: 02e86a1af1315f6fd5a7033c65dd1e9e7abbbbd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeac19cbc9d449803e8283d385b14f309273d35d7620d3a834a493123428b4f887f07bf96afb1b7a7f87ea580926cbdb7d104f5bc973c69f6b46b51e42795d53
|
7
|
+
data.tar.gz: da7f0756f86a33674ccfb83b0f2a5ddedaac4a7ed155894f8217b536c7c4b1136065d72a73a237311e456e5d47d63acd681569d8138ab0abf49045b8c9d87d9c
|
data/CHANGELOG.md
ADDED
@@ -13,19 +13,20 @@ module Valuables
|
|
13
13
|
|
14
14
|
# Like Ruby's +#freeze+ but recurses into contained values.
|
15
15
|
def deep_freeze(obj)
|
16
|
-
|
16
|
+
case obj
|
17
|
+
when ->(obj) { obj.respond_to?(:deep_freeze) }
|
17
18
|
obj.deep_freeze
|
18
|
-
|
19
|
+
when Hash
|
19
20
|
obj.reduce({}) do |acc, (key, value)|
|
20
21
|
acc.merge deep_freeze(key) => deep_freeze(value)
|
21
22
|
end.freeze
|
22
|
-
|
23
|
+
when Array
|
23
24
|
obj.reduce([]) do |acc, value|
|
24
25
|
acc << deep_freeze(value)
|
25
26
|
end.freeze
|
26
|
-
|
27
|
+
when Range
|
27
28
|
deep_freeze(obj.begin)..deep_freeze(obj.end).freeze
|
28
|
-
|
29
|
+
when Symbol, Fixnum
|
29
30
|
obj
|
30
31
|
else
|
31
32
|
obj.dup.freeze
|
data/lib/valuables/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valuables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arjan van der Gaag
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,6 +68,7 @@ extra_rdoc_files: []
|
|
68
68
|
files:
|
69
69
|
- ".gitignore"
|
70
70
|
- ".travis.yml"
|
71
|
+
- CHANGELOG.md
|
71
72
|
- CODE_OF_CONDUCT.md
|
72
73
|
- Gemfile
|
73
74
|
- LICENSE.txt
|