rhook 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -71,7 +71,7 @@ module RHook
71
71
 
72
72
  def call_method(name, method_name, args, block, opt = {})
73
73
  hooks = concat_hooks([], name)
74
- hooks.empty? and @obj.__send__(method_name, *args, &block)
74
+ hooks.empty? and return @obj.__send__(method_name, *args, &block)
75
75
 
76
76
  inv = Invocation.new
77
77
  inv.target = @obj
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rhook}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kaoru Kobo"]
@@ -10,6 +10,39 @@ describe "rhook (minor specifications / behavior, and bugs)" do
10
10
  Target._rhook.unbind_all()
11
11
  end
12
12
 
13
+ # ================================================================
14
+ describe "invocation" do
15
+ describe "is proceed by correct order & not rerun." do
16
+ class Target
17
+ attr_reader :order_ary
18
+ def order_call
19
+ @order_ary = []
20
+ _rhook.to.order_target
21
+ end
22
+
23
+ def order_target
24
+ @order_ary << "orig"
25
+ end
26
+ end
27
+
28
+ example do
29
+ t = Target.new
30
+
31
+ # [bug] It calls the target method/procedure twice when no hooks are registered.
32
+ t.order_call
33
+ t.order_ary.should == ["orig"]
34
+
35
+ t._rhook.bind(:order_target) do |inv|
36
+ t.order_ary << "before_call"
37
+ inv.call
38
+ t.order_ary << "after_call"
39
+ end
40
+ t.order_call
41
+ t.order_ary.should == ["before_call", "orig", "after_call"]
42
+ end
43
+ end
44
+ end
45
+
13
46
  # ================================================================
14
47
  describe "hack" do
15
48
  # ================================================================
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kaoru Kobo