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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f4e9bf748d15b19c380abbba179e9a16dab17469
4
- data.tar.gz: 9c67ac60615107e21dc97a5c7457e0a97e5fd0fe
2
+ SHA256:
3
+ metadata.gz: 68cfa4f7078032495f8d3216c677c0286c1cc2ab92101749b5e7a411698f18e6
4
+ data.tar.gz: fa45319a95d4d4ffa1b1b9b65dd7179a417a0016f0f34563d4108236be5e39e1
5
5
  SHA512:
6
- metadata.gz: 9867825e101289aaafd31d92fb64868813305ba4029da1c39ce9ccd99a22f0bcf3effacc8b1d8c9f29b01a131b947f37facb30eead647246487eab941239247d
7
- data.tar.gz: b2aeb4d4b03e7b3d729deb42e1c9f1117df6b1ef04618d2d412aa2efdfebe21e2361f90e22da4cd57825196732edf1a3526084030555091cb0c9a31786800138
6
+ metadata.gz: 6cd4306d7564c1971ad128f178b771ae4563c4bb25fc53d6dc799259f8b4052480a4be3681e7152c27adc6c8cbf4f48fefdf16629140fac3b0b8a3b17169ab64
7
+ data.tar.gz: 34d44af77a3dda603131f6dedd10abd23d5a3910f936407a32c357df18ad663407ded3742d4d735d4ee747404acbbdb44cd376a06184443c8d55a69237d2e5db
@@ -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.2.1"
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.2.1
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: 2017-10-27 00:00:00.000000000 Z
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.5.1
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.