evalhook 0.4.0 → 0.4.1
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.
- data/CHANGELOG +2 -0
- data/Rakefile +1 -1
- data/lib/evalhook/tree_processor.rb +1 -1
- data/spec/hook_handler/hook_handler_hook_spec.rb +39 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -239,7 +239,7 @@ module EvalHook
|
|
239
239
|
thirdcall = s(:call,secondcall,:set_class,s(:arglist, superclass_call_tree))
|
240
240
|
|
241
241
|
# pass the args passed to super
|
242
|
-
s(:call, thirdcall, :call, s(:arglist, *tree[1..-1]))
|
242
|
+
s(:call, thirdcall, :call, process(s(:arglist, *tree[1..-1])))
|
243
243
|
|
244
244
|
end
|
245
245
|
|
@@ -179,4 +179,43 @@ describe EvalHook::HookHandler, "hook handler hooks" do
|
|
179
179
|
', binding).should be == 10
|
180
180
|
end
|
181
181
|
|
182
|
+
class Y9 < X2
|
183
|
+
|
184
|
+
end
|
185
|
+
it "should intercept call on arguments of super" do
|
186
|
+
h = EvalHook::HookHandler.new
|
187
|
+
|
188
|
+
# reference to X for inheritance
|
189
|
+
h.should_receive(:handle_const).with("X2")
|
190
|
+
|
191
|
+
# reference to Y
|
192
|
+
h.should_receive(:handle_const).with("Y2")
|
193
|
+
|
194
|
+
# call to new
|
195
|
+
h.should_receive(:handle_method).with(Y2.class,Y2,:new)
|
196
|
+
|
197
|
+
# first Y#foo call
|
198
|
+
h.should_receive(:handle_method).with(Y2,anything(),:foo)
|
199
|
+
|
200
|
+
# call Y#bar
|
201
|
+
h.should_receive(:handle_method).with(Y2,anything(),:bar)
|
202
|
+
|
203
|
+
# super call
|
204
|
+
h.should_receive(:handle_method).with(X2,anything(),:foo)
|
205
|
+
|
206
|
+
h.evalhook('
|
207
|
+
|
208
|
+
class Y2 < X2
|
209
|
+
def bar
|
210
|
+
9
|
211
|
+
end
|
212
|
+
def foo(a)
|
213
|
+
super(bar)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
Y2.new.foo(9)
|
217
|
+
|
218
|
+
', binding).should be == 10
|
219
|
+
|
220
|
+
end
|
182
221
|
end
|
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: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.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-
|
18
|
+
date: 2011-06-09 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|