wrap 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/b.rb +58 -0
- data/lib/wrap.rb +3 -3
- data/wrap.gemspec +2 -1
- metadata +5 -4
data/b.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'wrap'
|
2
|
+
|
3
|
+
|
4
|
+
class C
|
5
|
+
include Wrap
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def method_missing(method, *args, &block)
|
9
|
+
case method.to_s
|
10
|
+
when %r/\A(before|after)_(.*)\Z/
|
11
|
+
lifecycle, method = $1, $2
|
12
|
+
send(lifecycle, method, *args, &block)
|
13
|
+
else
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
before_initialize do
|
20
|
+
p :before_initialize
|
21
|
+
end
|
22
|
+
|
23
|
+
after_initialize do
|
24
|
+
p :after_initialize
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
C.new
|
29
|
+
|
30
|
+
__END__
|
31
|
+
class C
|
32
|
+
include Wrap
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def method_missing(method, *args, &block)
|
36
|
+
p :method => method, :args => args
|
37
|
+
puts
|
38
|
+
case method.to_s
|
39
|
+
when %r/\A(before|after)_(.*)\Z/
|
40
|
+
lifecycle, method = $1, $2
|
41
|
+
wrap(method)
|
42
|
+
send(lifecycle, method, *args, &block)
|
43
|
+
else
|
44
|
+
super
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
before_initialize do
|
50
|
+
p :before_initialize
|
51
|
+
end
|
52
|
+
|
53
|
+
after_initialize do
|
54
|
+
p :after_initialize
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
C.new
|
data/lib/wrap.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
##
|
6
6
|
#
|
7
7
|
class << Wrap
|
8
|
-
Wrap::Version = '1.
|
8
|
+
Wrap::Version = '1.5.0' unless defined?(Wrap::Version)
|
9
9
|
|
10
10
|
def version
|
11
11
|
Wrap::Version
|
@@ -75,14 +75,14 @@
|
|
75
75
|
code =
|
76
76
|
<<-__
|
77
77
|
#{ signature.strip }
|
78
|
-
|
78
|
+
|
79
79
|
if running_callbacks?(#{ name.inspect })
|
80
80
|
return wrapped_#{ name }(*args, &block)
|
81
81
|
end
|
82
82
|
|
83
83
|
running_callbacks(#{ name.inspect }) do
|
84
84
|
catch(:halt) do
|
85
|
-
return false
|
85
|
+
return false if run_callbacks(:before, #{ name.inspect }, args)==false
|
86
86
|
|
87
87
|
begin
|
88
88
|
result = wrapped_#{ name }(*args, &block)
|
data/wrap.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "wrap"
|
6
|
-
spec.version = "1.
|
6
|
+
spec.version = "1.5.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "wrap"
|
9
9
|
spec.description = "description: wrap kicks the ass"
|
@@ -11,6 +11,7 @@ Gem::Specification::new do |spec|
|
|
11
11
|
spec.files =
|
12
12
|
["README",
|
13
13
|
"Rakefile",
|
14
|
+
"b.rb",
|
14
15
|
"lib",
|
15
16
|
"lib/wrap",
|
16
17
|
"lib/wrap.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
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: 2012-
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: map
|
16
|
-
requirement: &
|
16
|
+
requirement: &70281867850260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 4.7.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70281867850260
|
25
25
|
description: ! 'description: wrap kicks the ass'
|
26
26
|
email: ara.t.howard@gmail.com
|
27
27
|
executables: []
|
@@ -30,6 +30,7 @@ extra_rdoc_files: []
|
|
30
30
|
files:
|
31
31
|
- README
|
32
32
|
- Rakefile
|
33
|
+
- b.rb
|
33
34
|
- lib/wrap.rb
|
34
35
|
- test/testing.rb
|
35
36
|
- test/wrap_test.rb
|