hash19 0.0.10 → 0.1.0

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: f058551acfa9dac0dc06b4974aad7bee1c35e1e2
4
- data.tar.gz: 576d2bce4e5b1af1ed7b627a61111f8c65a2cf84
3
+ metadata.gz: bd7aefc6e059fa2ba78256565a3e4c013aefa45b
4
+ data.tar.gz: acef49c8de9299b6e93823dbea8bca8f00b481fb
5
5
  SHA512:
6
- metadata.gz: 4e2014f2d9e025517a1a4f5d720ffaf15ce707b7183597113605c94080a083e8c1640a10bdc10ff0e6174a77a97bf75c2b99a76091262750d269c69437f57945
7
- data.tar.gz: a6c4c73367b57840c60395efcca0e37050d229e8a48e11b278d66f3191f4ab82e2469402ef4dfff88ec5f2524f894eca9f391516377afb24ef36bafec655fdeb
6
+ metadata.gz: 4c40e4807096a11ad6f38c87f854b0298acda2ea8c9bb342ceb55a2f462fe562150ed637a2eee125c33427abd5790c79803740a84f717c847be80fab2743cc15
7
+ data.tar.gz: ae8faf7d7f16f6eac88a5a8ddfc70ca1010e6673d6d3da23fc112c88a1e8fda1d84cc09cc75994c8f231962105378b7dd6b72570bdfb5d7d0532ff36005e34db
@@ -35,7 +35,8 @@ module Hash19
35
35
 
36
36
  def resolve_aliases
37
37
  self.class.aliases.each do |key, as|
38
- @hash19[as] = @hash19.delete(key) if @hash19.has_key?(key)
38
+ @hash19[as] = @hash19[key] if @hash19.has_key?(key)
39
+ @hash19.delete(key) unless self.class.aliases.values.include?(key)
39
40
  end
40
41
  end
41
42
 
@@ -1,3 +1,3 @@
1
1
  module Hash19
2
- VERSION = '0.0.10'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -74,4 +74,15 @@ describe Hash19::Core do
74
74
  end
75
75
  end
76
76
 
77
+ context 'alias and key are same scenario' do
78
+ class Aliaser < Testable
79
+ attribute :me_too, key: :me
80
+ attribute :me, key: :thyself
81
+ end
82
+ it 'should be able to resolve alias' do
83
+ ap = Aliaser.new('thyself' => 1, 'me' => 2)
84
+ expect(ap.to_h).to eq('me' => 1, 'me_too' => 2)
85
+ end
86
+ end
87
+
77
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash19
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.4.5
175
+ rubygems_version: 2.4.6
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: Hash helpers to map complex JSON to ruby objects. Handles associations and