hash_attr 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dbd7e9e4bf8f02f166797dc1666273fea6ac404
4
- data.tar.gz: 31949ec17301307a6dc0a24e0983e1bbcba7102a
3
+ metadata.gz: 4125f3a02340a06054517a93f69c4395bcd38344
4
+ data.tar.gz: 3295741c413d3d9bfdc14747ceed4a5a13bbe655
5
5
  SHA512:
6
- metadata.gz: 31e2eb5b9ff3db1e9155e6be392187d94656cfb7ce19d9efa0d9f9fc25de5679ffbd719773a2e7692d2264cbf38510bdfffd4a6fd6ccbbf03994f28c05fa0774
7
- data.tar.gz: 1e70e1fdf34244db1a5d96bf3e06522af53e1d5e97d5e025b073ccd63d3a4afd3dde2e87864940cc73ddf1374188503f8e459dc7b3173f7dbc6cc4874f6ffc03
6
+ metadata.gz: 15da3a13c06ea78c669d73453517ab8ae936c57cb7d8f66c8ac1d0798a19286c97dda23b75884eb103abd8a12ea0eff8ca6400a0b6b8c6d7135092d05824ec71
7
+ data.tar.gz: 9a152c4d2be9c8ab5c6cb81e0c3879aa83f1a4c42ef42e20e066dc1e3078a1b58c9b1e32721beec6fb4783b4481afd19912c874245d7d91947deb5ec3979796c
@@ -1,3 +1,3 @@
1
1
  module HashAttr
2
- VERSION = "0.1.1"
3
- end
2
+ VERSION = "0.1.2"
3
+ end
data/lib/hash_attr.rb CHANGED
@@ -22,7 +22,7 @@ module HashAttr
22
22
  end
23
23
 
24
24
  def attributes
25
- Hash[@attribute_hash.map { |key, value| [key, value(value)] }]
25
+ @attribute_hash.nil? ? {} : Hash[@attribute_hash.map { |key, value| [key, value(value)] }]
26
26
  end
27
27
 
28
28
  private
@@ -35,7 +35,7 @@ module HashAttr
35
35
  when hash_attr then
36
36
  object.attributes
37
37
  when hash then
38
- object
38
+ Hash[object.map { |key, val| [key, value(val)] }]
39
39
  when mappable then
40
40
  object.map { |val| value(val) }
41
41
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_attr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SecondMarket