eaternet 0.3.15 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eaternet/agencies/nyc.rb +2 -2
- data/lib/eaternet/version.rb +1 -1
- data/lib/ext/enumerator.rb +3 -3
- data/test/ext/enumerator_test.rb +15 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef3eddd900122c5e8f53d818fba1deb47716df2
|
4
|
+
data.tar.gz: 52ac0c10468d7712d859a4777b9af4715d5f0acb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d28c75ef42a9912cdf467a4a66bb8b2c94d50c3068f9487671fae3151c387dd556d570ed92aa11b2041c5d9e6be0e7d2dd8cf3f1ffe3f8d410712217f0ac5e
|
7
|
+
data.tar.gz: 37272ef7459e1fce60371bc32849928ff3a25f805528e63d382ecfc2fb3e78c632c662da71265d931c1e9e4c446c24083185f2ba2bf365154f8c82474041feb7
|
@@ -63,7 +63,7 @@ module Eaternet
|
|
63
63
|
# @return [Enumerable<Business>]
|
64
64
|
def businesses
|
65
65
|
map_csv { |row| try_to_create_business(row) }
|
66
|
-
.
|
66
|
+
.uniq
|
67
67
|
.compact
|
68
68
|
end
|
69
69
|
|
@@ -83,7 +83,7 @@ module Eaternet
|
|
83
83
|
# @return [Enumerable<Inspection>]
|
84
84
|
def inspections
|
85
85
|
map_csv { |row| skip_inspection?(row) ? nil : try_to_create_inspection(row) }
|
86
|
-
.
|
86
|
+
.uniq
|
87
87
|
.compact
|
88
88
|
end
|
89
89
|
|
data/lib/eaternet/version.rb
CHANGED
data/lib/ext/enumerator.rb
CHANGED
@@ -3,11 +3,11 @@ class Enumerator
|
|
3
3
|
#
|
4
4
|
# @return [Enumerator] with {nil}s removed
|
5
5
|
def compact
|
6
|
-
|
6
|
+
reject(&:nil?)
|
7
7
|
end
|
8
8
|
|
9
9
|
# @return [Enumerator] only my unique elements
|
10
|
-
def
|
11
|
-
|
10
|
+
def uniq
|
11
|
+
to_a.uniq.each
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'ext/enumerator'
|
4
|
+
|
5
|
+
class EnumeratorTest < Minitest::Test
|
6
|
+
|
7
|
+
def test_finds_unique_elements
|
8
|
+
assert_equal [1,2,3], [1,2,3,1,2,3].each.uniq.to_a
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_removes_nils
|
12
|
+
assert_equal [1,2,3], [1,nil,nil,2,3].each.compact.to_a
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eaternet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- test/eaternet/lives_1_0/legend_test.rb
|
210
210
|
- test/eaternet/loggable_test.rb
|
211
211
|
- test/eaternet/util_test.rb
|
212
|
+
- test/ext/enumerator_test.rb
|
212
213
|
- test/fixtures/morris-park-bake-shop.csv
|
213
214
|
- test/script.rb
|
214
215
|
- test/test_helper.rb
|
@@ -246,6 +247,7 @@ test_files:
|
|
246
247
|
- test/eaternet/lives_1_0/legend_test.rb
|
247
248
|
- test/eaternet/loggable_test.rb
|
248
249
|
- test/eaternet/util_test.rb
|
250
|
+
- test/ext/enumerator_test.rb
|
249
251
|
- test/fixtures/morris-park-bake-shop.csv
|
250
252
|
- test/script.rb
|
251
253
|
- test/test_helper.rb
|