streamingly 0.2.6 → 0.2.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb1beb209148a563eaf9fc4f4d635607aceeebe3
4
- data.tar.gz: 8631b810159e70ad32b5b2f34d5c811f1867cec5
3
+ metadata.gz: fc109e04512bb35ddda55ac4c5fb3382de3721a0
4
+ data.tar.gz: db45a7738730ee44d8e81cb8af84d65e84c8a70a
5
5
  SHA512:
6
- metadata.gz: 50b045493f03acd398b1ab93955472b93c07842b01e6446bd338250c224652b0d4a5d4a1f14e04c8d476ecb63a16954fc356742f82e16b55877f2ddbeb6e2988
7
- data.tar.gz: 959f72ea4361803e7439dd7241b8f666f23bc39b0334c9d4f2b9cebf531b627b3bea2046b05773f4104127056535954c661c22b9638f27ca41b1b5c7573cfeaa
6
+ metadata.gz: e84efeb36af91513a007fea9649576449a90b210bbc4794933e6f87eae06eb04e6b39115afc8c50bf69e63b116c607e8844d9dc0a1dbc8254f2518d4239a3028
7
+ data.tar.gz: 282203153fb041b9ca631255b2b6069b28d91050868a9f5dbfebb828e6f5dc2d8350628406695ea5d0663f700cbefa5255106d5fc2448a111c7552cfdc57e3ba
@@ -20,7 +20,12 @@ module Streamingly
20
20
 
21
21
  end
22
22
 
23
- private
23
+ def on_error(error, error_context)
24
+ raise error unless @error_callback_defined && !@accumulator.nil?
25
+ @accumulator.on_error(error, error_context)
26
+ end
27
+
28
+ private
24
29
 
25
30
  def flush
26
31
  @accumulator ? (@accumulator.flush || []).compact : []
@@ -52,11 +57,6 @@ module Streamingly
52
57
  []
53
58
  end
54
59
 
55
- def on_error(error, error_context)
56
- raise error unless @error_callback_defined && !@accumulator.nil?
57
- @accumulator.on_error(error, error_context)
58
- end
59
-
60
60
  def new_accumulator(key)
61
61
  if @accumulator_options
62
62
  @accumulator_class.new(key, @accumulator_options)
@@ -14,7 +14,7 @@ module Streamingly
14
14
  yield Streamingly::SerDe.from_tabbed_csv(line)
15
15
  rescue => error
16
16
  if @error_callback_defined
17
- @error_handler.send(:on_error, error, line: line)
17
+ @error_handler.on_error(error, line: line)
18
18
  else
19
19
  raise error
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module Streamingly
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
@@ -41,6 +41,12 @@ describe Streamingly::Reducer do
41
41
  let(:accumulator_class) { double(:accumulator_class, :method_defined? => true) }
42
42
  subject { described_class.new(accumulator_class) }
43
43
 
44
+ describe '#on_error' do
45
+ it 'is exposed as public method' do
46
+ expect(subject).to respond_to(:on_error)
47
+ end
48
+ end
49
+
44
50
  describe "#reduce_over" do
45
51
 
46
52
  context "given records with the same key" do
@@ -1,5 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
+ class TestErrorHandler
4
+ def on_error(error, context)
5
+ nil
6
+ end
7
+ end
8
+
3
9
  describe Streamingly::SerDeIterable do
4
10
  let(:iterable) { [1] }
5
11
  let(:error) { StandardError.new('error') }
@@ -17,7 +23,7 @@ describe Streamingly::SerDeIterable do
17
23
  end
18
24
 
19
25
  describe 'given custom error handler' do
20
- let(:error_handler) { double(:error_handler, respond_to?: true) }
26
+ let(:error_handler) { TestErrorHandler.new }
21
27
  subject { described_class.new(iterable, error_handler) }
22
28
 
23
29
  it 'calls on_error method of provided handler' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: streamingly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Gillooly