dottie 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +1 -1
- data/dottie.gemspec +1 -1
- data/lib/dottie/version.rb +1 -1
- data/lib/dottie.rb +2 -2
- data/spec/dottie_spec.rb +12 -12
- data/spec/freckle_spec.rb +8 -8
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 56422c24e86966e8928fdd65ae47c56527a1ac72c75d0d6ff7674fa6c467088b
|
4
|
+
data.tar.gz: 815ece0b81778ef2ab9a66dbe8e467fffc1500a73ca7f30e2d13957d51ad83fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0878011a1e5a80b62a8aedcc81b48da2777768d5d2011829e4669db535c2999e6c2b41ab668bbfe7d209d35e123bcd669ee434c377c3344924ff462c6d349eca'
|
7
|
+
data.tar.gz: f371ca692a797e919b6f4ad89cd205365d4e06e8f1d422ce753221d151524ee9a4637c7ef9e63e77d5562618307b71cc31ed891b3ab82e1f4341fee59b08c20b
|
data/Rakefile
CHANGED
data/dottie.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "
|
23
|
+
spec.add_development_dependency "bundler", ">= 2.2.33"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
end
|
data/lib/dottie/version.rb
CHANGED
data/lib/dottie.rb
CHANGED
@@ -139,7 +139,7 @@ module Dottie
|
|
139
139
|
key = Dottie.build_key(key_parts[0..-2])
|
140
140
|
obj = Dottie.get(obj, key)
|
141
141
|
end
|
142
|
-
if obj.is_a?(Array) && key_parts.last.is_a?(
|
142
|
+
if obj.is_a?(Array) && key_parts.last.is_a?(Integer)
|
143
143
|
obj.delete_at(key_parts.last)
|
144
144
|
else
|
145
145
|
obj.delete(key_parts.last)
|
@@ -241,7 +241,7 @@ module Dottie
|
|
241
241
|
when String
|
242
242
|
key << '.' unless i == 0
|
243
243
|
key << part
|
244
|
-
when
|
244
|
+
when Integer
|
245
245
|
key << "[#{part}]"
|
246
246
|
end
|
247
247
|
end
|
data/spec/dottie_spec.rb
CHANGED
@@ -164,28 +164,28 @@ describe Dottie do
|
|
164
164
|
let(:hash) {{ 'a' => 'b', 'c' => { 'd' => ['e', 'f', 'g'] } }}
|
165
165
|
|
166
166
|
it "finds a standard key" do
|
167
|
-
expect(Dottie.has_key?(hash, 'a')).to
|
167
|
+
expect(Dottie.has_key?(hash, 'a')).to be true
|
168
168
|
end
|
169
169
|
it "does not find a missing standard key" do
|
170
|
-
expect(Dottie.has_key?(hash, 'x')).to
|
170
|
+
expect(Dottie.has_key?(hash, 'x')).to be false
|
171
171
|
end
|
172
172
|
it "finds a Dottie key (Hash value)" do
|
173
|
-
expect(Dottie.has_key?(hash, 'c.d')).to
|
173
|
+
expect(Dottie.has_key?(hash, 'c.d')).to be true
|
174
174
|
end
|
175
175
|
it "finds a Dottie key (Array element)" do
|
176
|
-
expect(Dottie.has_key?(hash, 'c.d[0]')).to
|
176
|
+
expect(Dottie.has_key?(hash, 'c.d[0]')).to be true
|
177
177
|
end
|
178
178
|
it "does not find a missing Dottie key (first part is a String)" do
|
179
|
-
expect(Dottie.has_key?(hash, 'a.b')).to
|
179
|
+
expect(Dottie.has_key?(hash, 'a.b')).to be false
|
180
180
|
end
|
181
181
|
it "does not find a missing Dottie key (first part exists)" do
|
182
|
-
expect(Dottie.has_key?(hash, 'c.x')).to
|
182
|
+
expect(Dottie.has_key?(hash, 'c.x')).to be false
|
183
183
|
end
|
184
184
|
it "does not find a missing Dottie key (outside Array bounds)" do
|
185
|
-
expect(Dottie.has_key?(hash, 'c.d[4]')).to
|
185
|
+
expect(Dottie.has_key?(hash, 'c.d[4]')).to be false
|
186
186
|
end
|
187
187
|
it "does not find a missing Dottie key (no part exists)" do
|
188
|
-
expect(Dottie.has_key?(hash, 'x.y')).to
|
188
|
+
expect(Dottie.has_key?(hash, 'x.y')).to be false
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
@@ -448,22 +448,22 @@ describe Dottie do
|
|
448
448
|
|
449
449
|
it 'recognizes a dotted key' do
|
450
450
|
key = 'a.b.c'
|
451
|
-
expect(Dottie.dottie_key?(key)).to
|
451
|
+
expect(Dottie.dottie_key?(key)).to be true
|
452
452
|
end
|
453
453
|
|
454
454
|
it 'recognizes a bracketed key' do
|
455
455
|
key = 'a[0]b'
|
456
|
-
expect(Dottie.dottie_key?(key)).to
|
456
|
+
expect(Dottie.dottie_key?(key)).to be true
|
457
457
|
end
|
458
458
|
|
459
459
|
it 'recognizes an array as a Dottie key' do
|
460
460
|
key = ['a', 'b', 'c']
|
461
|
-
expect(Dottie.dottie_key?(key)).to
|
461
|
+
expect(Dottie.dottie_key?(key)).to be true
|
462
462
|
end
|
463
463
|
|
464
464
|
it 'does not recognize a normal key' do
|
465
465
|
key = 'a_b_c'
|
466
|
-
expect(Dottie.dottie_key?(key)).to
|
466
|
+
expect(Dottie.dottie_key?(key)).to be false
|
467
467
|
end
|
468
468
|
|
469
469
|
end
|
data/spec/freckle_spec.rb
CHANGED
@@ -147,28 +147,28 @@ describe Dottie::Freckle do
|
|
147
147
|
let(:freckle) { Dottie::Freckle.new({ 'a' => 'b', 'c' => { 'd' => ['e', 'f', 'g'] } }) }
|
148
148
|
|
149
149
|
it "finds a standard key" do
|
150
|
-
expect(freckle.has_key?('a')).to
|
150
|
+
expect(freckle.has_key?('a')).to be true
|
151
151
|
end
|
152
152
|
it "does not find a missing standard key" do
|
153
|
-
expect(freckle.has_key?('x')).to
|
153
|
+
expect(freckle.has_key?('x')).to be false
|
154
154
|
end
|
155
155
|
it "finds a Dottie key (Hash value)" do
|
156
|
-
expect(freckle.has_key?('c.d')).to
|
156
|
+
expect(freckle.has_key?('c.d')).to be true
|
157
157
|
end
|
158
158
|
it "finds a Dottie key (Array element)" do
|
159
|
-
expect(freckle.has_key?('c.d[0]')).to
|
159
|
+
expect(freckle.has_key?('c.d[0]')).to be true
|
160
160
|
end
|
161
161
|
it "does not find a missing Dottie key (first part is a String)" do
|
162
|
-
expect(freckle.has_key?('a.b')).to
|
162
|
+
expect(freckle.has_key?('a.b')).to be false
|
163
163
|
end
|
164
164
|
it "does not find a missing Dottie key (first part exists)" do
|
165
|
-
expect(freckle.has_key?('c.x')).to
|
165
|
+
expect(freckle.has_key?('c.x')).to be false
|
166
166
|
end
|
167
167
|
it "does not find a missing Dottie key (outside Array bounds)" do
|
168
|
-
expect(freckle.has_key?('c.d[4]')).to
|
168
|
+
expect(freckle.has_key?('c.d[4]')).to be false
|
169
169
|
end
|
170
170
|
it "does not find a missing Dottie key (no part exists)" do
|
171
|
-
expect(freckle.has_key?('x.y')).to
|
171
|
+
expect(freckle.has_key?('x.y')).to be false
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dottie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pearson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.33
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.33
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +85,7 @@ homepage: https://github.com/nickpearson/dottie
|
|
85
85
|
licenses:
|
86
86
|
- MIT
|
87
87
|
metadata: {}
|
88
|
-
post_install_message:
|
88
|
+
post_install_message:
|
89
89
|
rdoc_options: []
|
90
90
|
require_paths:
|
91
91
|
- lib
|
@@ -100,9 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
|
104
|
-
|
105
|
-
signing_key:
|
103
|
+
rubygems_version: 3.2.33
|
104
|
+
signing_key:
|
106
105
|
specification_version: 4
|
107
106
|
summary: Deep Hash and Array access with dotted keys
|
108
107
|
test_files:
|