evalhook 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Rakefile +1 -1
- data/lib/evalhook.rb +10 -2
- data/spec/hook_handler/hook_handler_defaults_spec.rb +17 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/evalhook.rb
CHANGED
@@ -90,12 +90,20 @@ module EvalHook
|
|
90
90
|
recv = ret.recv
|
91
91
|
end
|
92
92
|
|
93
|
+
method_object = nil
|
94
|
+
|
95
|
+
begin
|
96
|
+
method_object = klass.instance_method(method_name).bind(recv)
|
97
|
+
rescue
|
98
|
+
method_object = recv.method(method_name)
|
99
|
+
end
|
100
|
+
|
93
101
|
if block_given?
|
94
|
-
|
102
|
+
method_object.call(*args) do |*x|
|
95
103
|
yield(*x)
|
96
104
|
end
|
97
105
|
else
|
98
|
-
|
106
|
+
method_object.call(*args)
|
99
107
|
end
|
100
108
|
end
|
101
109
|
end
|
@@ -226,5 +226,22 @@ describe EvalHook::HookHandler, "hook handler defaults" do
|
|
226
226
|
a = 9
|
227
227
|
EvalHook::HookHandler.new.evalhook("a").should be == 9
|
228
228
|
end
|
229
|
+
|
230
|
+
module TestInheritedClassMethodError
|
231
|
+
class A
|
232
|
+
def self.foo
|
233
|
+
'Foo'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
class B < A
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
it "inherited class method should execute" do
|
242
|
+
hh = EvalHook::HookHandler.new
|
243
|
+
hh.evalhook('TestInheritedClassMethodError::B.foo', binding)
|
244
|
+
end
|
245
|
+
|
229
246
|
end
|
230
247
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evalhook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dario Seminara
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-10 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|