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 CHANGED
@@ -1,3 +1,5 @@
1
+ 0.3.1 Fixed bug when use reflection on call handler (thanks jembezmamy for the feedback!)
2
+
1
3
  0.3.0 Refactor: removed C extension for hooking and use partialruby instead
2
4
 
3
5
  0.2.0 Added support to hook xstr nodes (system calls with backsticks and %x)
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
6
6
 
7
7
  spec = Gem::Specification.new do |s|
8
8
  s.name = 'evalhook'
9
- s.version = '0.3.0'
9
+ s.version = '0.3.1'
10
10
  s.author = 'Dario Seminara'
11
11
  s.email = 'robertodarioseminara@gmail.com'
12
12
  s.platform = Gem::Platform::RUBY
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
- klass.instance_method(method_name).bind(recv).call(*args) do |*x|
102
+ method_object.call(*args) do |*x|
95
103
  yield(*x)
96
104
  end
97
105
  else
98
- klass.instance_method(method_name).bind(recv).call(*args)
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
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-03 00:00:00 -03:00
18
+ date: 2011-04-10 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency