hooks 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/hooks.rb +6 -3
  2. data/test/hooks_test.rb +1 -1
  3. metadata +7 -7
@@ -16,7 +16,7 @@ require "hooks/inheritable_attribute"
16
16
  #
17
17
  # cat.run_hook :after_dinner
18
18
  module Hooks
19
- VERSION = "0.1.2"
19
+ VERSION = "0.1.3"
20
20
 
21
21
  def self.included(base)
22
22
  base.extend InheritableAttribute
@@ -47,8 +47,11 @@ module Hooks
47
47
 
48
48
  def run_hook_for(name, scope, *args)
49
49
  callbacks_for_hook(name).each do |callback|
50
- scope.send(callback, *args) and next if callback.kind_of? Symbol
51
- callback.call(*args)
50
+ if callback.kind_of? Symbol
51
+ scope.send(callback, *args)
52
+ else
53
+ callback.call(*args)
54
+ end
52
55
  end
53
56
  end
54
57
 
@@ -49,7 +49,7 @@ class HooksTest < ActiveSupport::TestCase
49
49
  context "Hooks#run_hook" do
50
50
  should "run without parameters" do
51
51
  @mum.instance_eval do
52
- def a; executed << :a; end
52
+ def a; executed << :a; nil; end
53
53
  def b; executed << :b; end
54
54
 
55
55
  self.class.after_eight :b
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Sutterer
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-11 00:00:00 +02:00
17
+ date: 2010-10-21 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -33,9 +33,9 @@ files:
33
33
  - Rakefile
34
34
  - lib/hooks.rb
35
35
  - lib/hooks/inheritable_attribute.rb
36
- - test/inheritable_attribute_test.rb
37
- - test/test_helper.rb
38
36
  - test/hooks_test.rb
37
+ - test/test_helper.rb
38
+ - test/inheritable_attribute_test.rb
39
39
  has_rdoc: true
40
40
  homepage: http://nicksda.apotomo.de/category/hooks
41
41
  licenses: []
@@ -69,6 +69,6 @@ signing_key:
69
69
  specification_version: 3
70
70
  summary: Generic hooks with callbacks for Ruby.
71
71
  test_files:
72
- - test/inheritable_attribute_test.rb
73
- - test/test_helper.rb
74
72
  - test/hooks_test.rb
73
+ - test/test_helper.rb
74
+ - test/inheritable_attribute_test.rb