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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd015ab0c5ca911589f85116ca59297a938ad9d8
4
- data.tar.gz: 35bacfa01690959bc0f051b6208d6b460c9cba6d
3
+ metadata.gz: fef3eddd900122c5e8f53d818fba1deb47716df2
4
+ data.tar.gz: 52ac0c10468d7712d859a4777b9af4715d5f0acb
5
5
  SHA512:
6
- metadata.gz: bdf91cc1304eb2c2ab998c06fb57c22e73bb0cf1e766c1abb5e148c43976db802d5da7981ad0843bfc456c6bd74969df60f5e7274012169d1c06fc7f940a0326
7
- data.tar.gz: cdceb406ed81a5eabb6d5cf9c78be604392f8022cf9c786fae625f726c24ccee572ed947935b192ce5f4e3c84d898e3f86b3be1ec2edea9984f55e44cc309fed
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
- .unique
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
- .unique
86
+ .uniq
87
87
  .compact
88
88
  end
89
89
 
@@ -1,3 +1,3 @@
1
1
  module Eaternet
2
- VERSION = '0.3.15'
2
+ VERSION = '0.3.16'
3
3
  end
@@ -3,11 +3,11 @@ class Enumerator
3
3
  #
4
4
  # @return [Enumerator] with {nil}s removed
5
5
  def compact
6
- select { |i| !i.nil? }
6
+ reject(&:nil?)
7
7
  end
8
8
 
9
9
  # @return [Enumerator] only my unique elements
10
- def unique
11
- Set.new(self).each
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.15
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