chickpea 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chickpea/version.rb +1 -1
- data/lib/chickpea.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57bec3d3f55c1041f65ce22af210c6e332f8053b1a49fc6fa63f742e70cd114
|
4
|
+
data.tar.gz: 4d2321b65720691345c2cfb9a1c80e49e9ef9dff8904d2e45a2995bfaaac3acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e25b877d61f535e68aafbbfc7f6d2db09a14abc07a67d8a6a9461020b4c370beeb4a23808a1aa4d2538f3a4684f5686bf718d8a9b5b8d3189188c1ba0d69778
|
7
|
+
data.tar.gz: c339809b3c7d0ec9a5f8933788c7ed9f642454e8fd7a2905b1f43a7c1e5df9ea5330f815845c0039298f74ef8c41972188504353ec0b2c8816bc8430a05493ac
|
data/lib/chickpea/version.rb
CHANGED
data/lib/chickpea.rb
CHANGED
@@ -42,6 +42,18 @@ module Chickpea
|
|
42
42
|
klass.define_method(key) { obj }
|
43
43
|
end
|
44
44
|
|
45
|
+
klass.define_method(:to_h) do
|
46
|
+
hash.map do |k, v|
|
47
|
+
[k, send(k).then { |r| v.is_a?(Hash) ? r.to_h : r }]
|
48
|
+
end.to_h
|
49
|
+
end
|
50
|
+
|
51
|
+
klass.define_method(:merge!) do |hash|
|
52
|
+
hash.each do |k, v|
|
53
|
+
v.is_a?(Hash) ? send(k).merge!(v) : send(:"#{k}=", v)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
45
57
|
klass.new
|
46
58
|
end
|
47
59
|
|