hashie 2.0.3 → 2.0.4
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.
- data/CHANGELOG.md +5 -0
- data/README.markdown +5 -9
- data/lib/hashie/mash.rb +2 -2
- data/lib/hashie/version.rb +1 -1
- data/spec/hashie/mash_spec.rb +12 -4
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.markdown
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
**Note:** This documentation is for the unreleased version 2.0 of
|
2
|
-
Hashie. See the [1-1-stable branch](https://github.com/intridea/hashie/tree/1-1-stable) for documentation of the released version.
|
3
|
-
|
4
1
|
# Hashie [](http://travis-ci.org/intridea/hashie) [](https://gemnasium.com/intridea/hashie)
|
5
2
|
|
6
3
|
Hashie is a growing collection of tools that extend Hashes and make
|
@@ -14,11 +11,10 @@ Hashie is available as a RubyGem:
|
|
14
11
|
|
15
12
|
## Hash Extensions
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
Hashie.
|
14
|
+
The library is broken up into a number of atomically includeable Hash
|
15
|
+
extension modules as described below. This provides maximum flexibility
|
16
|
+
for users to mix and match functionality while maintaining feature parity
|
17
|
+
with earlier versions of Hashie.
|
22
18
|
|
23
19
|
Any of the extensions listed below can be mixed into a class by
|
24
20
|
`include`-ing `Hashie::Extensions::ExtensionName`.
|
@@ -237,4 +233,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
237
233
|
|
238
234
|
## Copyright
|
239
235
|
|
240
|
-
Copyright (c) 2009-
|
236
|
+
Copyright (c) 2009-2013 Intridea, Inc. (http://intridea.com/). See LICENSE for details.
|
data/lib/hashie/mash.rb
CHANGED
data/lib/hashie/version.rb
CHANGED
data/spec/hashie/mash_spec.rb
CHANGED
@@ -297,19 +297,19 @@ describe Hashie::Mash do
|
|
297
297
|
it 'should respond to a set key' do
|
298
298
|
Hashie::Mash.new(:abc => 'def').should be_respond_to(:abc)
|
299
299
|
end
|
300
|
-
|
300
|
+
|
301
301
|
it 'should respond to a set key with a suffix' do
|
302
302
|
%w(= ? ! _).each do |suffix|
|
303
303
|
Hashie::Mash.new(:abc => 'def').should be_respond_to(:"abc#{suffix}")
|
304
304
|
end
|
305
305
|
end
|
306
|
-
|
306
|
+
|
307
307
|
it 'should respond to an unknown key with a suffix' do
|
308
308
|
%w(= ? ! _).each do |suffix|
|
309
309
|
Hashie::Mash.new(:abc => 'def').should be_respond_to(:"xyz#{suffix}")
|
310
310
|
end
|
311
311
|
end
|
312
|
-
|
312
|
+
|
313
313
|
it "should not respond to an unknown key without a suffix" do
|
314
314
|
Hashie::Mash.new(:abc => 'def').should_not be_respond_to(:xyz)
|
315
315
|
end
|
@@ -365,7 +365,7 @@ describe Hashie::Mash do
|
|
365
365
|
end
|
366
366
|
|
367
367
|
describe "#fetch" do
|
368
|
-
let(:hash) { {:one => 1} }
|
368
|
+
let(:hash) { {:one => 1, :other => false} }
|
369
369
|
let(:mash) { Hashie::Mash.new(hash) }
|
370
370
|
|
371
371
|
context "when key exists" do
|
@@ -373,6 +373,10 @@ describe Hashie::Mash do
|
|
373
373
|
mash.fetch(:one).should eql(1)
|
374
374
|
end
|
375
375
|
|
376
|
+
it "returns the value even if the value is falsy" do
|
377
|
+
mash.fetch(:other).should eql(false)
|
378
|
+
end
|
379
|
+
|
376
380
|
context "when key has other than original but acceptable type" do
|
377
381
|
it "returns the value" do
|
378
382
|
mash.fetch('one').should eql(1)
|
@@ -390,6 +394,10 @@ describe Hashie::Mash do
|
|
390
394
|
it "returns default value" do
|
391
395
|
mash.fetch(:two, 8).should eql(8)
|
392
396
|
end
|
397
|
+
|
398
|
+
it "returns default value even if it is falsy" do
|
399
|
+
mash.fetch(:two, false).should eql(false)
|
400
|
+
end
|
393
401
|
end
|
394
402
|
|
395
403
|
context "with block given" do
|
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: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
segments:
|
159
159
|
- 0
|
160
|
-
hash:
|
160
|
+
hash: 2159890714195675822
|
161
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
162
|
none: false
|
163
163
|
requirements:
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
segments:
|
168
168
|
- 0
|
169
|
-
hash:
|
169
|
+
hash: 2159890714195675822
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
172
|
rubygems_version: 1.8.23
|