fetching 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17a2d47d0a5f371c2f183a86e4f0251f8b84d522
4
- data.tar.gz: 78bd54db29bee8f7a3f86f8e168279e4ee00474e
3
+ metadata.gz: d376f053b0ff1258626543fce7a932245218cbfc
4
+ data.tar.gz: 4fce06a064b39f7017cb4a5bc2eb312e19db3fcc
5
5
  SHA512:
6
- metadata.gz: 04933886fb1e0623087cea84a87da2a2af2c541af9d1a0ada4ad4ae4e4b685c7c0273f156f87483ca5f9cbcf7725a4255b34ef51f6d0d21b31008cd777cca1eb
7
- data.tar.gz: 347ff59ef74c2076c0514b943d30c3b7a94f5d27b8e4777df5635629bf9e2809db3a9cc2c3d246e994dc628c3269e6e9cff71457a5697ce5d80b42c002ff7075
6
+ metadata.gz: 25a61cf2c0b4338d5a17530881b5d87fc6cdf4656726aca674dc007dbac02456ff00f141d536fb2daa414a9347fb0ba750d643ff7e16e621e74d010ef7bdd764
7
+ data.tar.gz: 656d5b6e258b930a5becb45ac94098e5c9ab59ea36c6473a0c8355152c3fa40d04be23c9100a200b196c9c0baf4f162731e12161ce589debebc3afd5ba5c8fac
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Fetching
2
2
 
3
- Turn deeply nested hashes and arrays (like an API response) into an whiney object with method syntax.
3
+ Turn deeply nested hashes and arrays (like an API response) into a whiney object with method syntax.
4
4
 
5
5
  ## Usage
6
6
 
@@ -1,3 +1,3 @@
1
1
  class Fetching
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
data/lib/fetching.rb CHANGED
@@ -17,6 +17,7 @@ class Fetching
17
17
  define_singleton_method instance_eval
18
18
  respond_to?
19
19
  instance_variables instance_variable_get
20
+ nil?
20
21
  )
21
22
 
22
23
  all_methods = instance_methods.map(&:to_s).grep(/\A[^_]/)
@@ -34,11 +34,11 @@ describe Fetching::FetchingArray do
34
34
  let(:fetching) { Fetching(array) }
35
35
 
36
36
  describe "#empty?" do
37
- it("should be false") { expect(fetching.empty?).to be_false }
37
+ it("should be false") { expect(fetching.empty?).to be_falsy }
38
38
 
39
39
  context "when empty" do
40
40
  let(:array) { [] }
41
- it("should be true") { expect(fetching.empty?).to be_true }
41
+ it("should be true") { expect(fetching.empty?).to be_truthy }
42
42
  end
43
43
  end
44
44
 
@@ -52,4 +52,32 @@ describe Fetching do
52
52
  expect(described_class.from_json(json)).to eq(expected)
53
53
  end
54
54
 
55
+ # some of these specs may seem redundant, but several cases
56
+ #+ generated NoMethodErrors previously so I wanted to make sure
57
+ #+ all use cases work now
58
+ describe '#nil?' do
59
+ it 'is true if the object is nil' do
60
+ expect(Fetching(nil)).to be_nil
61
+ end
62
+
63
+ it 'is true if the value of a key in a FetchingHash is nil' do
64
+ expect(Fetching(value: nil).value).to be_nil
65
+ end
66
+
67
+ it 'is true if the value of an index in a FetchingArray is nil' do
68
+ expect(Fetching(['a', nil, 'b'])[1]).to be_nil
69
+ end
70
+
71
+ it 'is false if the object has a value' do
72
+ expect(Fetching({})).not_to be_nil
73
+ end
74
+
75
+ it 'is false if the value of a key in a FetchingHash is non-nil' do
76
+ expect(Fetching(value: 'not nil!').value).not_to be_nil
77
+ end
78
+
79
+ it 'is false if the value of an index in a FetchingArray is non-nil' do
80
+ expect(Fetching(['a', 1, 'b'])[1]).not_to be_nil
81
+ end
82
+ end
55
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetching
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gee
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-18 00:00:00.000000000 Z
12
+ date: 2014-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
- rubygems_version: 2.0.6
114
+ rubygems_version: 2.4.4
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: 'This gem is a work in progress. The implementation code is not what''s