ribbon-plugins 0.2.0 → 0.2.1

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: b1203cf7726507ab9760f6ba519ea768fcbf5c19
4
- data.tar.gz: 93210e25c99e2d1381c64baff34375e9d41c9f4f
3
+ metadata.gz: cf4947ad31a06c8efa7a9327d44bee7dfdec5d14
4
+ data.tar.gz: 9bb844a020b92fb3eb2b9139fdaba188655018b8
5
5
  SHA512:
6
- metadata.gz: a016c927a8a9061452311957494d201bc6ffb220c68582358b048626171baa0042f38d2841e1f46b37c169aa2f28209a502d4b32ad837ffb95e4556b9971a2ee
7
- data.tar.gz: 2eaf238f288063cf187e7c6f0454b4a1ce2dddfb6dec76c2d1def45b0acafd3c65a4978beac6704cb317f6f01ce977d693329bdab89c73f413c8ed4e34aafe83
6
+ metadata.gz: 1ea53501e2018f3c80b96072654a1a3129ff3f75404b7de9687a37ae9483ef31180d47a40fe8763ccb8ede31cc3c148b308e3323f305e756e107b3b57fa8f0a6
7
+ data.tar.gz: ad3eec6fedac66772257671af6013e56eee18672aebab3f3496fd32ef734eac3cb43c8b87a43cb68ca17be5559d8bb58c0bf7183e21540fdc3d20eb846f4f2ee
@@ -24,6 +24,11 @@ class Ribbon::Plugins
24
24
 
25
25
  outer_most = call_stack.pop
26
26
  outer_most.call(call_stack, *args)
27
+
28
+ # This shouldn't happen unless the AroundStack isn't functioning properly.
29
+ raise Errors::Error, "Block passed was not called!" unless inner_most.called?
30
+
31
+ inner_most.retval
27
32
  end
28
33
 
29
34
  class AroundWrapper
@@ -49,14 +54,22 @@ class Ribbon::Plugins
49
54
 
50
55
  class WrappedBlock
51
56
  attr_reader :block
57
+ attr_reader :retval
52
58
 
53
59
  def initialize(&block)
54
60
  @block = block
55
61
  end
56
62
 
63
+ def called?
64
+ !!@_called
65
+ end
66
+
57
67
  def call(call_stack, *args)
58
68
  raise Errors::Error, 'receiving non-empty call stack' unless call_stack.empty?
59
- block.call(*args)
69
+ block.call(*args).tap { |retval|
70
+ @retval = retval
71
+ @_called = true
72
+ }
60
73
  end
61
74
  end
62
75
  end # AroundStack
@@ -1,5 +1,5 @@
1
1
  module Ribbon
2
2
  class Plugins
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -39,8 +39,10 @@ module Ribbon
39
39
 
40
40
  def perform(subject, *args, &block)
41
41
  before(subject, *args)
42
- around(subject, *args, &block)
42
+ retval = around(subject, *args, &block)
43
43
  after(subject, *args)
44
+
45
+ retval
44
46
  end
45
47
 
46
48
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ribbon-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Honer