ettin 1.1.0 → 1.1.1

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: 17fdcd8956f8975bcd9410dc6d8f1981fe456c36
4
- data.tar.gz: 154504874c1efc6d60f045376b05e15962208813
3
+ metadata.gz: 10a5902f647b9772c30966700e003151b9bc08cb
4
+ data.tar.gz: 5241db1d8824dff1032a403a971b59503256cc2c
5
5
  SHA512:
6
- metadata.gz: 7ce4768cef0f9cc3dae5f8babf451b5688e7298ffd8e66ef31ea87f1830400aa1c8a2155e71d7158726502c65ec85297e77035f5983543566577bdc955337206
7
- data.tar.gz: 9bdcd9fe40a892fcad2c86e04090ce8e408a4236d3cc3b98f6567fe7ec3b23e9ef3feaab191558751861d0ceb1aef58f8d72771a846ed615cc6de1a71821c169
6
+ metadata.gz: 52d11cf101a3eee2c5a8dec8637147043232f8a61135fed7aa243a945fdd58115088967a2bf6183ec923ecbe12842725a76a91bb2135d3756405853e71affe69
7
+ data.tar.gz: 2932215d9352310b8e8b41efff2a6256c2aa6622aa3a2af7714b63dba27a0a70186028e9c90151c985db3577d9e2a6a27b28ae8b92e0fdd347feec5c555c1fd6
@@ -3,7 +3,6 @@
3
3
  require "deep_merge/rails_compat"
4
4
  require "ettin/deep_transform"
5
5
  require "ettin/source"
6
- require "ettin/key"
7
6
 
8
7
  module Ettin
9
8
 
@@ -15,7 +14,7 @@ module Ettin
15
14
  .flatten
16
15
  .map {|target| Source.for(target) }
17
16
  .map(&:load)
18
- .map {|h| h.deep_transform_keys {|key| Key.new(key) } }
17
+ .map {|h| h.deep_transform_keys {|key| key.to_s.to_sym } }
19
18
  .each {|h| hash.deeper_merge!(h, overwrite_arrays: true) }
20
19
  hash
21
20
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "ettin/key"
4
3
  require "deep_merge/rails_compat"
5
4
 
6
5
  module Ettin
@@ -39,7 +38,7 @@ module Ettin
39
38
  end
40
39
 
41
40
  def key?(key)
42
- hash.key?(Key.new(key))
41
+ hash.key?(convert_key(key))
43
42
  end
44
43
  alias_method :has_key?, :key?
45
44
 
@@ -48,11 +47,11 @@ module Ettin
48
47
  end
49
48
 
50
49
  def [](key)
51
- convert(hash[Key.new(key)])
50
+ convert(hash[convert_key(key)])
52
51
  end
53
52
 
54
53
  def []=(key, value)
55
- hash[Key.new(key)] = value
54
+ hash[convert_key(key)] = value
56
55
  end
57
56
 
58
57
  def to_h
@@ -89,6 +88,10 @@ module Ettin
89
88
  end
90
89
  end
91
90
 
91
+ def convert_key(key)
92
+ key.to_s.to_sym
93
+ end
94
+
92
95
  def convert(value)
93
96
  case value
94
97
  when Hash
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ettin
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ettin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Hockey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-07 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -118,7 +118,6 @@ files:
118
118
  - lib/ettin/config_files.rb
119
119
  - lib/ettin/deep_transform.rb
120
120
  - lib/ettin/hash_factory.rb
121
- - lib/ettin/key.rb
122
121
  - lib/ettin/options.rb
123
122
  - lib/ettin/source.rb
124
123
  - lib/ettin/sources/hash_source.rb
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ettin
4
-
5
- # Internal hash key that handles strings and symbols as
6
- # the same type.
7
- class Key
8
- def initialize(key)
9
- @key = key
10
- end
11
-
12
- def inspect
13
- to_sym.inspect
14
- end
15
-
16
- def class
17
- Symbol
18
- end
19
-
20
- def to_s
21
- key.to_s
22
- end
23
-
24
- def to_sym
25
- to_s.to_sym
26
- end
27
-
28
- def eql?(other)
29
- to_sym == other.to_s.to_sym
30
- end
31
- alias_method :==, :eql?
32
-
33
- def hash
34
- key.to_s.to_sym.hash
35
- end
36
-
37
- private
38
-
39
- attr_reader :key
40
-
41
- end
42
- end