functional_hash 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/functional_hash.rb +7 -0
- data/lib/functional_hash/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 68cfa4f7078032495f8d3216c677c0286c1cc2ab92101749b5e7a411698f18e6
|
4
|
+
data.tar.gz: fa45319a95d4d4ffa1b1b9b65dd7179a417a0016f0f34563d4108236be5e39e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cd4306d7564c1971ad128f178b771ae4563c4bb25fc53d6dc799259f8b4052480a4be3681e7152c27adc6c8cbf4f48fefdf16629140fac3b0b8a3b17169ab64
|
7
|
+
data.tar.gz: 34d44af77a3dda603131f6dedd10abd23d5a3910f936407a32c357df18ad663407ded3742d4d735d4ee747404acbbdb44cd376a06184443c8d55a69237d2e5db
|
data/lib/functional_hash.rb
CHANGED
@@ -32,4 +32,11 @@ class FunctionalHash < Hash
|
|
32
32
|
Hash.class_eval { undef_method :fn }
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
def self.from_hash(hash)
|
37
|
+
raise ArgumentError, 'FunctionalHash.from_hash requires a Hash' unless hash.is_a? Hash
|
38
|
+
new.tap do |fn_hash|
|
39
|
+
hash.each { |k, v| fn_hash[k.dup] = v.dup }
|
40
|
+
end
|
41
|
+
end
|
35
42
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
class FunctionalHash < Hash
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "0.3.0"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functional_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Myers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.7.6
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Easily set hash values to be functions of other values in the same hash.
|