exception_extensions 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: c3c47e4bb28d9ae98c08a3615463ca6d6ea68077865d9b924e7de1f832ac8d81
4
- data.tar.gz: da3808b89a03780cd2be5c1c6d1572f7bedc0f14835914e537416ae396e0c2f3
3
+ metadata.gz: 692a23af69f5de4e2695de4157997c929655fc9be32a5361bb63595670e34a9c
4
+ data.tar.gz: 9c2d7dfe97989c03c7ad38fc7a9a86b89633ffb45c314d48cc832fb14f5a9418
5
5
  SHA512:
6
- metadata.gz: 62e4fc9e0ac251808dd0066b8b04af90dafd518e0dc1d17192c2514397b27e55003780db474ed26166277d16eb1112b2e394679d132cee8e23c4b9183771d896
7
- data.tar.gz: 5badd9bda7a3648965de8107d7aaf4a2812500a21a0869ae9531785c8575fde2cfe09acbd11d7d82d1b5b5ecdda1bae02cf55df8c58b50bf6bc05b88b563ffff
6
+ metadata.gz: f62fe2a11f4396760ecff839fdba595072d313b819c86d0d95b7d0fcd5f6e3fa70447f7562f0a59ee1096f50508c69f9290ee2383830e189bf3bf982a4eddab1
7
+ data.tar.gz: 4795fee7e9a36cd94fde4b09b3829b3e359b623c08a5022691e9a08ee25cd7005db20d718430e4f32c0d74de27f281c47fc57b4b181acbf30f97c289146f5bd2
data/README.md CHANGED
@@ -24,7 +24,7 @@ gem 'exception_extensions'
24
24
  ## Usage Examples
25
25
 
26
26
  ### Assume the following operation
27
- ```
27
+ ```ruby
28
28
  def the_operation
29
29
  # collection of exceptions
30
30
  exceptions = []
@@ -47,7 +47,7 @@ end
47
47
  ```
48
48
 
49
49
  ### Example1: Calling the_operation directly
50
- ```
50
+ ```ruby
51
51
  begin
52
52
  the_operation
53
53
  rescue => exc
@@ -73,7 +73,7 @@ exception2 message: expected a 1
73
73
  ```
74
74
 
75
75
  ### Example2: Calling the_operation indirectly resulting in an exception chain
76
- ```
76
+ ```ruby
77
77
  # here, we illustrate traversing the exception chain
78
78
  def handle_operations
79
79
  the_operation
@@ -118,4 +118,4 @@ exception2 class: ArgumentError
118
118
  exception2 message: expected a 1
119
119
  JOINED: "Unable to handle operations => multiple exceptions occurred during the_operation => expected a 1"
120
120
 
121
- ```
121
+ ```
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'exception_extensions'
3
- gem.version = '1.0.1'
3
+ gem.version = '1.0.2'
4
4
  gem.date = '2019-11-27'
5
5
  gem.summary = 'Useful extensions for Ruby Exceptions'
6
6
  gem.description = 'Useful extensions for Ruby Exceptions; Adds support for Exceptions with multiple causes (useful when executing fan-out operations) and Exception cause traversal.'
@@ -1,8 +1,12 @@
1
1
  module ExceptionExtensions
2
2
  class ExceptionPathTraverser < ExceptionTraverser
3
3
  def each(&block)
4
- return if @exception.nil?
5
- each_internal(@exception, [], &block)
4
+ if block_given?
5
+ return if @exception.nil?
6
+ each_internal(@exception, [], &block)
7
+ else
8
+ to_enum(:each)
9
+ end
6
10
  end
7
11
 
8
12
  private
@@ -22,4 +26,4 @@ module ExceptionExtensions
22
26
  path.pop
23
27
  end
24
28
  end
25
- end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloud 66