hashie 3.4.4 → 3.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -21
- data/README.md +8 -1
- data/lib/hashie.rb +6 -0
- data/lib/hashie/array.rb +11 -0
- data/lib/hashie/extensions/array/pretty_inspect.rb +19 -0
- data/lib/hashie/extensions/deep_locate.rb +1 -1
- data/lib/hashie/extensions/parsers/yaml_erb_parser.rb +1 -1
- data/lib/hashie/extensions/ruby_version_check.rb +15 -0
- data/lib/hashie/mash.rb +5 -1
- data/lib/hashie/version.rb +1 -1
- data/spec/hashie/array_spec.rb +17 -0
- data/spec/hashie/mash_spec.rb +9 -2
- data/spec/hashie/parsers/yaml_erb_parser_spec.rb +30 -13
- data/spec/spec_helper.rb +2 -0
- data/spec/support/ruby_version_check.rb +5 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17fdc7085bfa65cd5c7e0b61542c36ba04be8d96
|
4
|
+
data.tar.gz: c93285de8532d7004bf94b472096c53654994aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a45b9b6a3bf7dcea2f581abbbfb64d5074e5389a82034f0b7cfeda02033b5b826c6f2634af378832c189763e12b5561d6e447bb487f0c4958b21d7498710ae4
|
7
|
+
data.tar.gz: 9ac837fb3daf0dd29fa734080d02845ba2a28f4f5f1434f5a0f7890f3f7dd548c31a666270df3ea0e5801541a62d29bd2d068fcb747fee9c38a44b0a2a27e8d1
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,27 @@ scheme are considered to be bugs.
|
|
6
6
|
|
7
7
|
[semver]: http://semver.org/spec/v2.0.0.html
|
8
8
|
|
9
|
+
## [3.4.5] - 2016-09-16
|
10
|
+
|
11
|
+
[3.4.5]: https://github.com/intridea/hashie/compare/v3.4.4...v3.4.5
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
* [#337](https://github.com/intridea/hashie/pull/337), [#331](https://github.com/intridea/hashie/issues/331): `Hashie::Mash#load` accepts a `Pathname` object - [@gipcompany](https://github.com/gipcompany).
|
16
|
+
|
17
|
+
### Deprecated
|
18
|
+
|
19
|
+
* [#366](https://github.com/intridea/hashie/pull/366): Hashie is no longer tested on Ruby < 2 - [@dblock](https://github.com/dblock).
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
* [#358](https://github.com/intridea/hashie/pull/358): Fixed support for Array#dig - [@modosc](https://github.com/modosc).
|
24
|
+
* [#365](https://github.com/intridea/hashie/pull/365): Ensured ActiveSupport::HashWithIndifferentAccess is defined before use in #deep_locate - [@mikejarema](https://github.com/mikejarema).
|
25
|
+
|
26
|
+
### Miscellanous
|
27
|
+
|
28
|
+
* [#366](https://github.com/intridea/hashie/pull/366): Added Danger, PR linter - [@dblock](https://github.com/dblock).
|
29
|
+
|
9
30
|
## [3.4.4] - 2016-04-29
|
10
31
|
|
11
32
|
[3.4.4]: https://github.com/intridea/hashie/compare/v3.4.3...v3.4.4
|
@@ -17,8 +38,8 @@ scheme are considered to be bugs.
|
|
17
38
|
### Fixed
|
18
39
|
|
19
40
|
* [#240](https://github.com/intridea/hashie/pull/240): Fixed nesting twice with Clash keys - [@bartoszkopinski](https://github.com/bartoszkopinski).
|
20
|
-
* [#317](https://github.com/intridea/hashie/pull/317):
|
21
|
-
* [#319](https://github.com/intridea/hashie/pull/319):
|
41
|
+
* [#317](https://github.com/intridea/hashie/pull/317): Ensured `Hashie::Extensions::MethodQuery` methods return boolean values - [@michaelherold](https://github.com/michaelherold).
|
42
|
+
* [#319](https://github.com/intridea/hashie/pull/319): Fixed a regression from 3.4.1 where `Hashie::Extensions::DeepFind` is no longer indifference-aware - [@michaelherold](https://github.com/michaelherold).
|
22
43
|
* [#322](https://github.com/intridea/hashie/pull/322): Fixed `reverse_merge` issue with `Mash` subclasses - [@marshall-lee](https://github.com/marshall-lee).
|
23
44
|
* [#346](https://github.com/intridea/hashie/pull/346): Fixed `merge` breaking indifferent access - [@docwhat](https://github.com/docwhat), [@michaelherold](https://github.com/michaelherold).
|
24
45
|
* [#350](https://github.com/intridea/hashie/pull/350): Fixed from string translations used with `IgnoreUndeclared` - [@marshall-lee](https://github.com/marshall-lee).
|
@@ -88,10 +109,10 @@ scheme are considered to be bugs.
|
|
88
109
|
### Fixed
|
89
110
|
|
90
111
|
* [#247](https://github.com/intridea/hashie/pull/247): Fixed #stringify_keys and #symbolize_keys collision with ActiveSupport - [@bartoszkopinski](https://github.com/bartoszkopinski).
|
91
|
-
* [#256](https://github.com/intridea/hashie/pull/256):
|
112
|
+
* [#256](https://github.com/intridea/hashie/pull/256): Inherited key coercions - [@Erol](https://github.com/Erol).
|
92
113
|
* [#259](https://github.com/intridea/hashie/pull/259): Fixed handling of default proc values in Mash - [@Erol](https://github.com/Erol).
|
93
114
|
* [#261](https://github.com/intridea/hashie/pull/261): Fixed bug where Dash.property modifies argument object - [@d-tw](https://github.com/d-tw).
|
94
|
-
* [#269](https://github.com/intridea/hashie/pull/269):
|
115
|
+
* [#269](https://github.com/intridea/hashie/pull/269): Added #extractable_options? so ActiveSupport Array#extract_options! can extract it - [@ridiculous](https://github.com/ridiculous).
|
95
116
|
|
96
117
|
## [3.3.2] - 2014-11-26
|
97
118
|
|
@@ -105,7 +126,7 @@ scheme are considered to be bugs.
|
|
105
126
|
|
106
127
|
### Fixed
|
107
128
|
|
108
|
-
* [#221](https://github.com/intridea/hashie/pull/221):
|
129
|
+
* [#221](https://github.com/intridea/hashie/pull/221): Reduced amount of allocated objects on calls with suffixes in Hashie::Mash - [@kubum](https://github.com/kubum).
|
109
130
|
* [#224](https://github.com/intridea/hashie/pull/224): Merging Hashie::Mash now correctly only calls the block on duplicate values - [@amysutedja](https://github.com/amysutedja).
|
110
131
|
* [#228](https://github.com/intridea/hashie/pull/228): Made Hashie::Extensions::Parsers::YamlErbParser pass template filename to ERB - [@jperville](https://github.com/jperville).
|
111
132
|
|
@@ -118,17 +139,17 @@ scheme are considered to be bugs.
|
|
118
139
|
* [#183](https://github.com/intridea/hashie/pull/183): Added Mash#load with YAML file support - [@gregory](https://github.com/gregory).
|
119
140
|
* [#189](https://github.com/intridea/hashie/pull/189): Added Rash#fetch - [@medcat](https://github.com/medcat).
|
120
141
|
* [#204](https://github.com/intridea/hashie/pull/204): Added Hashie::Extensions::MethodOverridingWriter and MethodAccessWithOverride - [@michaelherold](https://github.com/michaelherold).
|
121
|
-
* [#205](
|
122
|
-
* [#209](
|
142
|
+
* [#205](https://github.com/intridea/hashie/pull/205): Added Hashie::Extensions::Mash::SafeAssignment - [@michaelherold](https://github.com/michaelherold).
|
143
|
+
* [#209](https://github.com/intridea/hashie/pull/209): Added Hashie::Extensions::DeepFind - [@michaelherold](https://github.com/michaelherold).
|
123
144
|
|
124
145
|
### Fixed
|
125
146
|
|
126
147
|
* [#69](https://github.com/intridea/hashie/pull/69): Fixed regression in assigning multiple properties in Hashie::Trash - [@michaelherold](https://github.com/michaelherold), [@einzige](https://github.com/einzige), [@dblock](https://github.com/dblock).
|
127
|
-
* [#195](https://github.com/intridea/hashie/pull/195):
|
148
|
+
* [#195](https://github.com/intridea/hashie/pull/195): Ensured that the same object is returned after injecting IndifferentAccess - [@michaelherold](https://github.com/michaelherold).
|
128
149
|
* [#201](https://github.com/intridea/hashie/pull/201): Hashie::Trash transforms can be inherited - [@fobocaster](https://github.com/fobocaster).
|
129
150
|
* [#200](https://github.com/intridea/hashie/pull/200): Improved coercion: primitives and error handling - [@maxlinc](https://github.com/maxlinc).
|
130
|
-
* [#206](
|
131
|
-
* [#207](
|
151
|
+
* [#206](https://github.com/intridea/hashie/pull/206): Fixed stack overflow from repetitively including coercion in subclasses - [@michaelherold](https://github.com/michaelherold).
|
152
|
+
* [#207](https://github.com/intridea/hashie/pull/207): Fixed inheritance of transformations in Trash - [@fobocaster](https://github.com/fobocaster).
|
132
153
|
|
133
154
|
## [3.2.0] - 2014-07-10
|
134
155
|
|
@@ -172,7 +193,7 @@ scheme are considered to be bugs.
|
|
172
193
|
|
173
194
|
[3.0.0]: https://github.com/intridea/hashie/compare/v2.1.2...v3.0.0
|
174
195
|
|
175
|
-
|
196
|
+
Note: This version introduces several backward incompatible API changes. See [UPGRADING](UPGRADING.md) for details.
|
176
197
|
|
177
198
|
### Added
|
178
199
|
|
@@ -213,7 +234,7 @@ scheme are considered to be bugs.
|
|
213
234
|
|
214
235
|
### Added
|
215
236
|
|
216
|
-
* [#134](https://github.com/intridea/hashie/pull/134):
|
237
|
+
* [#134](https://github.com/intridea/hashie/pull/134): Added deep_fetch extension for nested access - [@tylerdooling](https://github.com/tylerdooling).
|
217
238
|
|
218
239
|
### Changed
|
219
240
|
|
@@ -249,7 +270,7 @@ scheme are considered to be bugs.
|
|
249
270
|
|
250
271
|
### Fixed
|
251
272
|
|
252
|
-
* [#96](https://github.com/intridea/hashie/pull/96):
|
273
|
+
* [#96](https://github.com/intridea/hashie/pull/96): Made coercion work better with non-symbol keys in Hashie::Mash - [@wapcaplet](https://github.com/wapcaplet).
|
253
274
|
|
254
275
|
## [2.0.4] - 2013-04-24
|
255
276
|
|
@@ -257,7 +278,7 @@ scheme are considered to be bugs.
|
|
257
278
|
|
258
279
|
### Fixed
|
259
280
|
|
260
|
-
* [#94](https://github.com/intridea/hashie/pull/94):
|
281
|
+
* [#94](https://github.com/intridea/hashie/pull/94): Made #fetch method consistent with normal Hash - [@markiz](https://github.com/markiz).
|
261
282
|
|
262
283
|
### Miscellaneous
|
263
284
|
|
@@ -269,7 +290,7 @@ scheme are considered to be bugs.
|
|
269
290
|
|
270
291
|
### Fixed
|
271
292
|
|
272
|
-
* [#68](https://github.com/intridea/hashie/pull/68):
|
293
|
+
* [#68](https://github.com/intridea/hashie/pull/68): Fixed #replace - [@jimeh](https://github.com/jimeh).
|
273
294
|
* [#88](https://github.com/intridea/hashie/pull/88): Hashie::Mash.new(abc: true).respond_to?(:abc?) works - [@7even](https://github.com/7even).
|
274
295
|
|
275
296
|
## [2.0.2] - 2013-02-26
|
@@ -278,7 +299,7 @@ scheme are considered to be bugs.
|
|
278
299
|
|
279
300
|
### Fixed
|
280
301
|
|
281
|
-
* [#85](https://github.com/intridea/hashie/pull/85):
|
302
|
+
* [#85](https://github.com/intridea/hashie/pull/85): Added symbolize_keys back to to_hash - [@cromulus](https://github.com/cromulus).
|
282
303
|
|
283
304
|
## [2.0.1] - 2013-02-26
|
284
305
|
|
@@ -286,11 +307,11 @@ scheme are considered to be bugs.
|
|
286
307
|
|
287
308
|
### Removed
|
288
309
|
|
289
|
-
* [#81](https://github.com/intridea/hashie/pull/81):
|
310
|
+
* [#81](https://github.com/intridea/hashie/pull/81): Removed Mash#object_id override - [@matschaffer](https://github.com/matschaffer).
|
290
311
|
|
291
312
|
### Miscellaneous
|
292
313
|
|
293
|
-
* Gem cleanup: removed VERSION, Gemfile.lock [@jch](https://github.com/jch), [@mbleigh](https://github.com/mbleigh).
|
314
|
+
* Gem cleanup: removed VERSION, Gemfile.lock - [@jch](https://github.com/jch), [@mbleigh](https://github.com/mbleigh).
|
294
315
|
|
295
316
|
## [2.0.0] - 2013-02-16
|
296
317
|
|
@@ -304,14 +325,14 @@ scheme are considered to be bugs.
|
|
304
325
|
### Changed
|
305
326
|
|
306
327
|
* [#28](https://github.com/intridea/hashie/pull/28): Hashie::Extensions::Coercion coerce_keys takes arguments - [@mattfawcett](https://github.com/mattfawcett).
|
307
|
-
* [#77](https://github.com/intridea/hashie/pull/77):
|
328
|
+
* [#77](https://github.com/intridea/hashie/pull/77): Removed id, type, and object_id as special allowable keys - [@jch](https://github.com/jch).
|
308
329
|
|
309
330
|
### Fixed
|
310
331
|
|
311
|
-
* [#27](https://github.com/intridea/hashie/pull/27):
|
332
|
+
* [#27](https://github.com/intridea/hashie/pull/27): Initialize with merge coerces values - [@mattfawcett](https://github.com/mattfawcett).
|
312
333
|
* [#39](https://github.com/intridea/hashie/pull/39): Trash removes translated values on initialization - [@sleverbor](https://github.com/sleverbor).
|
313
334
|
* [#49](https://github.com/intridea/hashie/pull/49): Hashie::Hash inherits from ::Hash to avoid ambiguity - [@meh](https://github.com/meh), [@orend](https://github.com/orend).
|
314
|
-
* [#62](https://github.com/intridea/hashie/pull/62):
|
335
|
+
* [#62](https://github.com/intridea/hashie/pull/62): Updated respond_to? method signature to match ruby core definition - [@dlupu](https://github.com/dlupu).
|
315
336
|
* [#63](https://github.com/intridea/hashie/pull/63): Dash defaults are dup'ed before assigned - [@ohrite](https://github.com/ohrite).
|
316
337
|
* [#66](https://github.com/intridea/hashie/pull/66): Mash#fetch works with symbol or string keys - [@arthwood](https://github.com/arthwood).
|
317
338
|
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ $ gem install hashie
|
|
20
20
|
|
21
21
|
## Upgrading
|
22
22
|
|
23
|
-
You're reading the documentation for the stable release of Hashie, 3.4.
|
23
|
+
You're reading the documentation for the stable release of Hashie, 3.4.5. Please read [UPGRADING](UPGRADING.md) when upgrading from a previous version.
|
24
24
|
|
25
25
|
## Hash Extensions
|
26
26
|
|
@@ -490,6 +490,13 @@ mash.development.api_key = "foo" # => <# RuntimeError can't modify frozen ...>
|
|
490
490
|
mash.development.api_key? # => true
|
491
491
|
```
|
492
492
|
|
493
|
+
You can also load with a `Pathname` object:
|
494
|
+
|
495
|
+
```ruby
|
496
|
+
mash = Mash.load(Pathname 'settings/twitter.yml')
|
497
|
+
mash.development.api_key # => 'localhost'
|
498
|
+
```
|
499
|
+
|
493
500
|
You can access a Mash from another class:
|
494
501
|
|
495
502
|
```ruby
|
data/lib/hashie.rb
CHANGED
@@ -7,6 +7,7 @@ module Hashie
|
|
7
7
|
autoload :Mash, 'hashie/mash'
|
8
8
|
autoload :Trash, 'hashie/trash'
|
9
9
|
autoload :Rash, 'hashie/rash'
|
10
|
+
autoload :Array, 'hashie/array'
|
10
11
|
|
11
12
|
module Extensions
|
12
13
|
autoload :Coercion, 'hashie/extensions/coercion'
|
@@ -27,6 +28,7 @@ module Hashie
|
|
27
28
|
autoload :KeyConversion, 'hashie/extensions/key_conversion'
|
28
29
|
autoload :MethodAccessWithOverride, 'hashie/extensions/method_access'
|
29
30
|
autoload :StrictKeyAccess, 'hashie/extensions/strict_key_access'
|
31
|
+
autoload :RubyVersionCheck, 'hashie/extensions/ruby_version_check'
|
30
32
|
|
31
33
|
module Parsers
|
32
34
|
autoload :YamlErbParser, 'hashie/extensions/parsers/yaml_erb_parser'
|
@@ -41,6 +43,10 @@ module Hashie
|
|
41
43
|
module Mash
|
42
44
|
autoload :SafeAssignment, 'hashie/extensions/mash/safe_assignment'
|
43
45
|
end
|
46
|
+
|
47
|
+
module Array
|
48
|
+
autoload :PrettyInspect, 'hashie/extensions/array/pretty_inspect'
|
49
|
+
end
|
44
50
|
end
|
45
51
|
|
46
52
|
class << self
|
data/lib/hashie/array.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hashie
|
2
|
+
module Extensions
|
3
|
+
module Array
|
4
|
+
module PrettyInspect
|
5
|
+
def self.included(base)
|
6
|
+
base.send :alias_method, :array_inspect, :inspect
|
7
|
+
base.send :alias_method, :inspect, :hashie_inspect
|
8
|
+
end
|
9
|
+
|
10
|
+
def hashie_inspect
|
11
|
+
ret = "#<#{self.class} ["
|
12
|
+
ret << to_a.map(&:inspect).join(', ')
|
13
|
+
ret << ']>'
|
14
|
+
ret
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -64,7 +64,7 @@ module Hashie
|
|
64
64
|
private
|
65
65
|
|
66
66
|
def self._construct_key_comparator(search_key, object)
|
67
|
-
search_key = search_key.to_s if defined?(::ActiveSupport) && object.is_a?(::ActiveSupport::HashWithIndifferentAccess)
|
67
|
+
search_key = search_key.to_s if defined?(::ActiveSupport::HashWithIndifferentAccess) && object.is_a?(::ActiveSupport::HashWithIndifferentAccess)
|
68
68
|
search_key = search_key.to_s if object.respond_to?(:indifferent_access?) && object.indifferent_access?
|
69
69
|
|
70
70
|
lambda do |non_callable_object|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Hashie
|
2
|
+
module Extensions
|
3
|
+
module RubyVersionCheck
|
4
|
+
def self.included(base)
|
5
|
+
base.extend ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def with_minimum_ruby(version)
|
10
|
+
yield if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new(version)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/hashie/mash.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'hashie/hash'
|
2
|
+
require 'hashie/array'
|
2
3
|
|
3
4
|
module Hashie
|
4
5
|
# Mash allows you to create pseudo-objects that have method-like
|
@@ -56,6 +57,7 @@ module Hashie
|
|
56
57
|
#
|
57
58
|
class Mash < Hash
|
58
59
|
include Hashie::Extensions::PrettyInspect
|
60
|
+
include Hashie::Extensions::RubyVersionCheck
|
59
61
|
|
60
62
|
ALLOWED_SUFFIXES = %w(? ! = _)
|
61
63
|
|
@@ -250,7 +252,7 @@ module Hashie
|
|
250
252
|
self.class.new(other_hash).merge(self)
|
251
253
|
end
|
252
254
|
|
253
|
-
|
255
|
+
with_minimum_ruby('2.3.0') do
|
254
256
|
def dig(*keys)
|
255
257
|
super(*keys.map { |key| convert_key(key) })
|
256
258
|
end
|
@@ -287,6 +289,8 @@ module Hashie
|
|
287
289
|
self.class.new(val)
|
288
290
|
when Array
|
289
291
|
val.map { |e| convert_value(e) }
|
292
|
+
when ::Array
|
293
|
+
Array.new(val.map { |e| convert_value(e) })
|
290
294
|
else
|
291
295
|
val
|
292
296
|
end
|
data/lib/hashie/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Array do
|
4
|
+
with_minimum_ruby('2.3.0') do
|
5
|
+
describe '#dig' do
|
6
|
+
let(:array) { Hashie::Array.new([:a, :b, :c]) }
|
7
|
+
|
8
|
+
it 'works with a string index' do
|
9
|
+
expect(array.dig('0')).to eq(:a)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'works with a numeric index' do
|
13
|
+
expect(array.dig(1)).to eq(:b)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/hashie/mash_spec.rb
CHANGED
@@ -687,14 +687,21 @@ describe Hashie::Mash do
|
|
687
687
|
end
|
688
688
|
end
|
689
689
|
|
690
|
-
|
690
|
+
with_minimum_ruby('2.3.0') do
|
691
691
|
describe '#dig' do
|
692
692
|
subject { described_class.new(a: { b: 1 }) }
|
693
|
-
|
694
693
|
it 'accepts both string and symbol as key' do
|
695
694
|
expect(subject.dig(:a, :b)).to eq(1)
|
696
695
|
expect(subject.dig('a', 'b')).to eq(1)
|
697
696
|
end
|
697
|
+
|
698
|
+
context 'with numeric key' do
|
699
|
+
subject { described_class.new('1' => { b: 1 }) }
|
700
|
+
it 'accepts a numeric value as key' do
|
701
|
+
expect(subject.dig(1, :b)).to eq(1)
|
702
|
+
expect(subject.dig('1', :b)).to eq(1)
|
703
|
+
end
|
704
|
+
end
|
698
705
|
end
|
699
706
|
end
|
700
707
|
end
|
@@ -2,28 +2,45 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Hashie::Extensions::Parsers::YamlErbParser do
|
4
4
|
describe '.perform' do
|
5
|
-
|
6
|
-
|
5
|
+
context 'a file' do
|
6
|
+
let(:config) do
|
7
|
+
<<-EOF
|
7
8
|
---
|
8
9
|
foo: verbatim
|
9
10
|
bar: <%= "erb" %>
|
10
11
|
baz: "<%= __FILE__ %>"
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
EOF
|
13
|
+
end
|
14
|
+
let(:path) { 'template.yml' }
|
15
|
+
|
16
|
+
subject { described_class.new(path).perform }
|
14
17
|
|
15
|
-
|
18
|
+
before do
|
19
|
+
expect(File).to receive(:read).with(path).and_return(config)
|
20
|
+
end
|
16
21
|
|
17
|
-
|
18
|
-
|
22
|
+
it { is_expected.to be_a(Hash) }
|
23
|
+
|
24
|
+
it 'parses YAML after interpolating ERB' do
|
25
|
+
expect(subject['foo']).to eq 'verbatim'
|
26
|
+
expect(subject['bar']).to eq 'erb'
|
27
|
+
expect(subject['baz']).to eq path
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
|
-
|
31
|
+
context 'Pathname' do
|
32
|
+
let(:tempfile) do
|
33
|
+
file = Tempfile.new(['foo', '.yml'])
|
34
|
+
file.write("---\nfoo: hello\n")
|
35
|
+
file.rewind
|
36
|
+
file
|
37
|
+
end
|
38
|
+
|
39
|
+
subject { described_class.new(Pathname tempfile.path) }
|
22
40
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
expect(subject['baz']).to eq path
|
41
|
+
it '"#perform" can be done in case of path is a Pathname object.' do
|
42
|
+
expect(subject.perform).to eq 'foo' => 'hello'
|
43
|
+
end
|
27
44
|
end
|
28
45
|
end
|
29
46
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,8 +8,10 @@ require 'pry'
|
|
8
8
|
require 'rspec'
|
9
9
|
require 'hashie'
|
10
10
|
require 'rspec/pending_for'
|
11
|
+
require './spec/support/ruby_version_check'
|
11
12
|
|
12
13
|
RSpec.configure do |config|
|
14
|
+
config.extend RubyVersionCheck
|
13
15
|
config.expect_with :rspec do |expect|
|
14
16
|
expect.syntax = :expect
|
15
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -70,8 +70,10 @@ files:
|
|
70
70
|
- UPGRADING.md
|
71
71
|
- hashie.gemspec
|
72
72
|
- lib/hashie.rb
|
73
|
+
- lib/hashie/array.rb
|
73
74
|
- lib/hashie/clash.rb
|
74
75
|
- lib/hashie/dash.rb
|
76
|
+
- lib/hashie/extensions/array/pretty_inspect.rb
|
75
77
|
- lib/hashie/extensions/coercion.rb
|
76
78
|
- lib/hashie/extensions/dash/coercion.rb
|
77
79
|
- lib/hashie/extensions/dash/indifferent_access.rb
|
@@ -88,6 +90,7 @@ files:
|
|
88
90
|
- lib/hashie/extensions/method_access.rb
|
89
91
|
- lib/hashie/extensions/parsers/yaml_erb_parser.rb
|
90
92
|
- lib/hashie/extensions/pretty_inspect.rb
|
93
|
+
- lib/hashie/extensions/ruby_version_check.rb
|
91
94
|
- lib/hashie/extensions/strict_key_access.rb
|
92
95
|
- lib/hashie/extensions/stringify_keys.rb
|
93
96
|
- lib/hashie/extensions/symbolize_keys.rb
|
@@ -96,6 +99,7 @@ files:
|
|
96
99
|
- lib/hashie/rash.rb
|
97
100
|
- lib/hashie/trash.rb
|
98
101
|
- lib/hashie/version.rb
|
102
|
+
- spec/hashie/array_spec.rb
|
99
103
|
- spec/hashie/clash_spec.rb
|
100
104
|
- spec/hashie/dash_spec.rb
|
101
105
|
- spec/hashie/extensions/autoload_spec.rb
|
@@ -124,6 +128,7 @@ files:
|
|
124
128
|
- spec/hashie/version_spec.rb
|
125
129
|
- spec/spec_helper.rb
|
126
130
|
- spec/support/module_context.rb
|
131
|
+
- spec/support/ruby_version_check.rb
|
127
132
|
homepage: https://github.com/intridea/hashie
|
128
133
|
licenses:
|
129
134
|
- MIT
|
@@ -144,11 +149,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
149
|
version: '0'
|
145
150
|
requirements: []
|
146
151
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.4
|
152
|
+
rubygems_version: 2.6.4
|
148
153
|
signing_key:
|
149
154
|
specification_version: 4
|
150
155
|
summary: Your friendly neighborhood hash library.
|
151
156
|
test_files:
|
157
|
+
- spec/hashie/array_spec.rb
|
152
158
|
- spec/hashie/clash_spec.rb
|
153
159
|
- spec/hashie/dash_spec.rb
|
154
160
|
- spec/hashie/extensions/autoload_spec.rb
|
@@ -177,3 +183,4 @@ test_files:
|
|
177
183
|
- spec/hashie/version_spec.rb
|
178
184
|
- spec/spec_helper.rb
|
179
185
|
- spec/support/module_context.rb
|
186
|
+
- spec/support/ruby_version_check.rb
|