method_callbacks 1.2.1 → 1.2.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 +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +3 -0
- data/lib/method_callbacks.rb +2 -2
- data/lib/method_callbacks/version.rb +1 -1
- data/spec/method_callbacks_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c8c9a7d4add55532337105dce6633cd8b5ad1fd
|
4
|
+
data.tar.gz: f72844fdae422df415f8214cf29138af8ff1581e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c6f3d6c4a2b1e9c83151cbb67dda0dd5355ae25e1c1e694b21ea7ad9ed984ae60f67053e1759dc1c91db528668c24402f3e16aa04358ef6fc820027a5c6b6e5
|
7
|
+
data.tar.gz: 7a58babe58bb6bf3a61498e3210dbe56e518abac38a79f260514c3a05a1342e6c6d5e00f379e8bfe8ba8168b409d32c2ebd6c65ef705639b6151080b2899820f
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
data/lib/method_callbacks.rb
CHANGED
@@ -50,8 +50,8 @@ module MethodCallbacks
|
|
50
50
|
method
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
54
|
-
__method_callbacks_redefine_method(
|
53
|
+
def method_added(method_name)
|
54
|
+
__method_callbacks_redefine_method(__method_callbacks_find(method_name))
|
55
55
|
|
56
56
|
super
|
57
57
|
end
|
@@ -20,6 +20,18 @@ describe MethodCallbacks do
|
|
20
20
|
expect(test_callbacks.action).to eq("Return value")
|
21
21
|
end
|
22
22
|
|
23
|
+
it "should work when callbacks defined before method definition" do
|
24
|
+
expect(test_callbacks).to receive(:puts).with("Executing intro")
|
25
|
+
|
26
|
+
expect(test_callbacks.test_define_before_method).to eq("Executing test_define_before_method")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should work when callbacks defined after method definition" do
|
30
|
+
expect(test_callbacks).to receive(:puts).with("Executing unload")
|
31
|
+
|
32
|
+
expect(test_callbacks.test_define_after_method).to eq("Executing test_define_after_method")
|
33
|
+
end
|
34
|
+
|
23
35
|
it "should proxy the result" do
|
24
36
|
expect(test_proxy_result.result).to eq("the original result was: hello!")
|
25
37
|
end
|
@@ -85,6 +97,16 @@ class TestCallbacks
|
|
85
97
|
puts "Executing post inner_around"
|
86
98
|
return_value
|
87
99
|
end
|
100
|
+
|
101
|
+
before_method :test_define_before_method, :intro
|
102
|
+
def test_define_before_method
|
103
|
+
"Executing test_define_before_method"
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_define_after_method
|
107
|
+
"Executing test_define_after_method"
|
108
|
+
end
|
109
|
+
after_method :test_define_after_method, :unload
|
88
110
|
end
|
89
111
|
|
90
112
|
class TestProxyResult
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_callbacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morgan Showman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
version_requirements: !ruby/object:Gem::Requirement
|