evalhook 0.5.6 → 0.5.7
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/tree_processor.rb +2 -2
- data/spec/hook_handler/hook_handler_defn_spec.rb +44 -0
- metadata +7 -6
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -217,7 +217,7 @@ module EvalHook
|
|
217
217
|
@last_args = tree[2]
|
218
218
|
@last_method_name = tree[1]
|
219
219
|
|
220
|
-
s(tree[0],tree[1],tree[2]
|
220
|
+
s(tree[0],tree[1],tree[2],*tree[3..-1].map(&method(:process)))
|
221
221
|
end
|
222
222
|
|
223
223
|
def superclass_call_tree
|
@@ -252,7 +252,7 @@ module EvalHook
|
|
252
252
|
|
253
253
|
def process_defs(tree)
|
254
254
|
block_tree = class_scope( "" ) {
|
255
|
-
|
255
|
+
s(:block, *tree[4..-1].map(&method(:process)))
|
256
256
|
}
|
257
257
|
s(:defs, process(tree[1]), tree[2], tree[3], block_tree)
|
258
258
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "evalhook"
|
3
|
+
|
4
|
+
describe EvalHook::HookHandler, "hook handler defn" do
|
5
|
+
|
6
|
+
class XXZ
|
7
|
+
def bar
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should execute two lines on defn" do
|
12
|
+
hook_handler = EvalHook::HookHandler.new
|
13
|
+
|
14
|
+
hook_handler.evalhook("
|
15
|
+
def foo(x)
|
16
|
+
x.bar
|
17
|
+
x.bar
|
18
|
+
end", binding)
|
19
|
+
|
20
|
+
xxz = XXZ.new
|
21
|
+
xxz.should_receive(:bar).twice
|
22
|
+
foo(xxz)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should execute two lines on defs" do
|
26
|
+
hook_handler = EvalHook::HookHandler.new
|
27
|
+
|
28
|
+
hook_handler.evalhook("
|
29
|
+
def set_foo(obj)
|
30
|
+
def obj.foo(x)
|
31
|
+
x.bar
|
32
|
+
x.bar
|
33
|
+
end
|
34
|
+
end", binding)
|
35
|
+
|
36
|
+
obj = Object.new
|
37
|
+
set_foo(obj)
|
38
|
+
|
39
|
+
xxz = XXZ.new
|
40
|
+
xxz.should_receive(:bar).twice
|
41
|
+
obj.foo(xxz)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evalhook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: partialruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &78285330 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *78285330
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sexp_processor
|
27
|
-
requirement: &
|
27
|
+
requirement: &78284200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '4.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *78284200
|
36
36
|
description:
|
37
37
|
email: robertodarioseminara@gmail.com
|
38
38
|
executables: []
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- spec/hook_handler/hook_handler_arguments_spec.rb
|
54
54
|
- spec/hook_handler/hook_handler_package_spec.rb
|
55
55
|
- spec/hook_handler/hook_handler_hook_spec.rb
|
56
|
+
- spec/hook_handler/hook_handler_defn_spec.rb
|
56
57
|
- spec/hook_handler/hook_handler_ruby_spec.rb
|
57
58
|
- spec/hook_handler/hook_handler_defaults_spec.rb
|
58
59
|
- spec/hook_handler/hook_handler_multiple_redirect_spec.rb
|