jackbox 0.9.6.2 → 0.9.6.3
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.
- checksums.yaml +13 -5
- data/CHANGES.txt +41 -1
- data/LICENSE.lic +0 -0
- data/README.md +244 -149
- data/Rakefile +6 -6
- data/jackbox.gemspec +3 -2
- data/lib/jackbox.rb +1 -1
- data/lib/jackbox/injectors.rb +1 -1
- data/lib/jackbox/rake.rb +1 -1
- data/lib/jackbox/tools/prefs.rb +1 -1
- data/lib/jackbox/version.rb +1 -1
- data/spec/lib/abtract_spec.rb +6 -6
- data/spec/lib/jackbox/injector_composition_spec.rb +106 -88
- data/spec/lib/jackbox/injector_directives_spec.rb +46 -0
- data/spec/lib/jackbox/injector_inheritance_spec.rb +980 -410
- data/spec/lib/jackbox/injector_introspection_spec.rb +333 -208
- data/spec/lib/jackbox/injector_spec.rb +28 -28
- data/spec/lib/jackbox/injector_versioning_spec.rb +1 -0
- data/spec/lib/jackbox/patterns_spec.rb +146 -14
- data/spec/lib/jackbox/reclassing_spec.rb +165 -78
- data/spec/lib/jackbox/vmc_spec.rb +246 -0
- metadata +32 -28
@@ -0,0 +1,246 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
=begin rdoc
|
3
|
+
|
4
|
+
VIRTUAL METHOD CACHE
|
5
|
+
|
6
|
+
Virtual methods are methods that have not beeen applied as part of any injection as of yet. They are not part of a version, execpt for the current one.
|
7
|
+
In as such, they are common to all injectors, and can service any of them. They stop being virtual when they become part of an injector application.
|
8
|
+
=end
|
9
|
+
include Injectors
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
# RubyProf.start
|
14
|
+
describe "VMC (Virtual Method Cache)" do
|
15
|
+
|
16
|
+
before do
|
17
|
+
jack :J1
|
18
|
+
jack :K1
|
19
|
+
jack :L1
|
20
|
+
jack :M1
|
21
|
+
jack :N1
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
J1(:implode)
|
26
|
+
K1(:implode)
|
27
|
+
L1(:implode)
|
28
|
+
M1(:implode)
|
29
|
+
N1(:implode)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'goes 3 deep' do
|
33
|
+
|
34
|
+
class AA4
|
35
|
+
inject J1()
|
36
|
+
end
|
37
|
+
J1 do
|
38
|
+
def n1m1
|
39
|
+
end
|
40
|
+
inject K1()
|
41
|
+
end
|
42
|
+
K1 do
|
43
|
+
def n2m1
|
44
|
+
end
|
45
|
+
inject L1()
|
46
|
+
end
|
47
|
+
L1 do
|
48
|
+
def n3m1
|
49
|
+
end
|
50
|
+
end
|
51
|
+
# debugger
|
52
|
+
AA4.new.n1m1
|
53
|
+
AA4.new.n2m1
|
54
|
+
AA4.new.n3m1
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'goes even deeper' do
|
59
|
+
|
60
|
+
class AA5
|
61
|
+
inject J1()
|
62
|
+
end
|
63
|
+
J1 do
|
64
|
+
inject K1()
|
65
|
+
end
|
66
|
+
K1 do
|
67
|
+
inject L1()
|
68
|
+
end
|
69
|
+
L1 do
|
70
|
+
inject M1()
|
71
|
+
end
|
72
|
+
M1 do
|
73
|
+
def daa
|
74
|
+
end
|
75
|
+
end
|
76
|
+
AA5.new.daa
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
it "does full coverage" do
|
81
|
+
|
82
|
+
Object.inject J1() # pretty low-level injection!! usually going to be higher than Object!!
|
83
|
+
|
84
|
+
o = Object.new
|
85
|
+
|
86
|
+
J1 do
|
87
|
+
def j1 # Virtual Method: not actually /\
|
88
|
+
:j1 # part of any injection yet! |
|
89
|
+
end # The injection happened before --
|
90
|
+
end # 1st level
|
91
|
+
o.j1.should == :j1
|
92
|
+
|
93
|
+
|
94
|
+
J1 do
|
95
|
+
inject K1()
|
96
|
+
end
|
97
|
+
K1 do
|
98
|
+
def k1 # Virtual Method!!
|
99
|
+
:k1 # 2nd level
|
100
|
+
end
|
101
|
+
end
|
102
|
+
o.k1.should == :k1
|
103
|
+
|
104
|
+
|
105
|
+
K1 do
|
106
|
+
inject L1()
|
107
|
+
end
|
108
|
+
L1 do
|
109
|
+
def l1 # Virtual Method!!
|
110
|
+
:l1 # 3rd level
|
111
|
+
end
|
112
|
+
end
|
113
|
+
o.l1.should == :l1
|
114
|
+
|
115
|
+
|
116
|
+
L1 do
|
117
|
+
inject M1()
|
118
|
+
end
|
119
|
+
M1() do
|
120
|
+
def m1 # Virtual Methods!!
|
121
|
+
:m1 # 4th level
|
122
|
+
end
|
123
|
+
def meth
|
124
|
+
:meth
|
125
|
+
end
|
126
|
+
end
|
127
|
+
o.m1.should == :m1
|
128
|
+
|
129
|
+
|
130
|
+
L1 do
|
131
|
+
inject N1()
|
132
|
+
end
|
133
|
+
N1 do
|
134
|
+
def n1 # Virtual Method!!
|
135
|
+
:n1 # 4th level also: same container
|
136
|
+
end
|
137
|
+
end
|
138
|
+
o.n1.should == :n1
|
139
|
+
|
140
|
+
# ...
|
141
|
+
|
142
|
+
expect{
|
143
|
+
o.j2
|
144
|
+
}.to raise_error(NoMethodError)
|
145
|
+
|
146
|
+
expect{
|
147
|
+
o.n2
|
148
|
+
}.to raise_error(NoMethodError)
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
the "converse example" do
|
153
|
+
|
154
|
+
J1 do # actual version methods
|
155
|
+
def j1 # they becomen part of the
|
156
|
+
:j1
|
157
|
+
end # following application of
|
158
|
+
end # this injector
|
159
|
+
|
160
|
+
K1 do
|
161
|
+
def k1
|
162
|
+
:k1
|
163
|
+
end
|
164
|
+
end
|
165
|
+
J1 do
|
166
|
+
inject K1() # injector application!
|
167
|
+
end
|
168
|
+
|
169
|
+
L1 do
|
170
|
+
def l1 # actual version methods
|
171
|
+
:l1
|
172
|
+
end
|
173
|
+
end
|
174
|
+
K1 do
|
175
|
+
inject L1() # injector application
|
176
|
+
end
|
177
|
+
|
178
|
+
M1() do
|
179
|
+
def m1
|
180
|
+
:m1
|
181
|
+
end
|
182
|
+
end
|
183
|
+
L1 do
|
184
|
+
inject M1()
|
185
|
+
end
|
186
|
+
|
187
|
+
Object.inject J1()
|
188
|
+
o = Object.new
|
189
|
+
|
190
|
+
expect {
|
191
|
+
o.j1.should == :j1
|
192
|
+
o.k1.should == :k1
|
193
|
+
o.l1.should == :l1
|
194
|
+
o.m1.should == :m1
|
195
|
+
}.not_to raise_error
|
196
|
+
|
197
|
+
expect{
|
198
|
+
o.j2
|
199
|
+
}.to raise_error(NoMethodError)
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'allows the use of super' do
|
204
|
+
|
205
|
+
Object.inject J1()
|
206
|
+
|
207
|
+
J1 do
|
208
|
+
def j1 # virtual methods
|
209
|
+
:j1
|
210
|
+
end
|
211
|
+
def meth
|
212
|
+
super + "#{j1}"
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
J1().inject K1()
|
217
|
+
|
218
|
+
K1 do
|
219
|
+
def k1 # virtual methods
|
220
|
+
:k1
|
221
|
+
end
|
222
|
+
def meth
|
223
|
+
super + "#{k1}"
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
K1().inject L1()
|
228
|
+
|
229
|
+
L1 do
|
230
|
+
def meth # virtual methods
|
231
|
+
"#{:l1}"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
o = Object.new
|
236
|
+
o.meth.should == 'l1k1j1' # this call is on the VMC!!!
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
# profile = RubyProf.stop
|
244
|
+
# RubyProf::FlatPrinter.new(profile).print(STDOUT)
|
245
|
+
# RubyProf::GraphHtmlPrinter.new(profile).print(open('profile.html', 'w+'))
|
246
|
+
# RubyProf::CallStackPrinter.new(profile).print(open('profile.html', 'w+'))
|
metadata
CHANGED
@@ -1,76 +1,78 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.6.
|
4
|
+
version: 0.9.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Henry Alvarez (LHA)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.6.1
|
20
|
-
- -
|
20
|
+
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: !binary |-
|
23
|
+
MS42
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
26
27
|
requirements:
|
27
|
-
- -
|
28
|
+
- - ! '>='
|
28
29
|
- !ruby/object:Gem::Version
|
29
30
|
version: 1.6.1
|
30
|
-
- -
|
31
|
+
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: !binary |-
|
34
|
+
MS42
|
33
35
|
- !ruby/object:Gem::Dependency
|
34
36
|
name: thor
|
35
37
|
requirement: !ruby/object:Gem::Requirement
|
36
38
|
requirements:
|
37
|
-
- -
|
39
|
+
- - ! '>='
|
38
40
|
- !ruby/object:Gem::Version
|
39
41
|
version: 0.18.1
|
40
|
-
- -
|
42
|
+
- - ~>
|
41
43
|
- !ruby/object:Gem::Version
|
42
44
|
version: '0.18'
|
43
45
|
type: :runtime
|
44
46
|
prerelease: false
|
45
47
|
version_requirements: !ruby/object:Gem::Requirement
|
46
48
|
requirements:
|
47
|
-
- -
|
49
|
+
- - ! '>='
|
48
50
|
- !ruby/object:Gem::Version
|
49
51
|
version: 0.18.1
|
50
|
-
- -
|
52
|
+
- - ~>
|
51
53
|
- !ruby/object:Gem::Version
|
52
54
|
version: '0.18'
|
53
55
|
- !ruby/object:Gem::Dependency
|
54
56
|
name: rspec
|
55
57
|
requirement: !ruby/object:Gem::Requirement
|
56
58
|
requirements:
|
57
|
-
- -
|
59
|
+
- - <=
|
58
60
|
- !ruby/object:Gem::Version
|
59
|
-
version: 3.
|
60
|
-
- -
|
61
|
+
version: '3.4'
|
62
|
+
- - ~>
|
61
63
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
64
|
+
version: 3.3.0
|
63
65
|
type: :development
|
64
66
|
prerelease: false
|
65
67
|
version_requirements: !ruby/object:Gem::Requirement
|
66
68
|
requirements:
|
67
|
-
- -
|
69
|
+
- - <=
|
68
70
|
- !ruby/object:Gem::Version
|
69
|
-
version: 3.
|
70
|
-
- -
|
71
|
+
version: '3.4'
|
72
|
+
- - ~>
|
71
73
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
73
|
-
description: 'Main gem for Ruby Code Injectors: Closures as Modules'
|
74
|
+
version: 3.3.0
|
75
|
+
description: ! 'Main gem for Ruby Code Injectors: Closures as Modules'
|
74
76
|
email:
|
75
77
|
- luisealvarezb@yahoo.com
|
76
78
|
executables:
|
@@ -78,8 +80,8 @@ executables:
|
|
78
80
|
extensions: []
|
79
81
|
extra_rdoc_files: []
|
80
82
|
files:
|
81
|
-
-
|
82
|
-
-
|
83
|
+
- .gitignore
|
84
|
+
- .yardopts
|
83
85
|
- CHANGES.txt
|
84
86
|
- LICENSE.lic
|
85
87
|
- LICENSE.txt
|
@@ -164,6 +166,7 @@ files:
|
|
164
166
|
- spec/lib/jackbox/patterns_spec.rb
|
165
167
|
- spec/lib/jackbox/prefs_spec.rb
|
166
168
|
- spec/lib/jackbox/reclassing_spec.rb
|
169
|
+
- spec/lib/jackbox/vmc_spec.rb
|
167
170
|
- spec/lib/jackbox_spec.rb
|
168
171
|
- spec/spec_helper.rb
|
169
172
|
homepage: http://jackbox.us
|
@@ -176,22 +179,22 @@ require_paths:
|
|
176
179
|
- lib
|
177
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
178
181
|
requirements:
|
179
|
-
- -
|
182
|
+
- - ! '>='
|
180
183
|
- !ruby/object:Gem::Version
|
181
184
|
version: '0'
|
182
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
186
|
requirements:
|
184
|
-
- -
|
187
|
+
- - ! '>='
|
185
188
|
- !ruby/object:Gem::Version
|
186
189
|
version: '0'
|
187
190
|
requirements: []
|
188
191
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.4.
|
192
|
+
rubygems_version: 2.4.8
|
190
193
|
signing_key:
|
191
194
|
specification_version: 4
|
192
195
|
summary: Jackbox is a set of programming tools which enhance the Ruby language and
|
193
|
-
provide some additional software constructs.
|
194
|
-
|
196
|
+
provide some additional software constructs. Main library for Modular Closures,
|
197
|
+
ReClasses, and Ruby Code Injectors.
|
195
198
|
test_files:
|
196
199
|
- spec/bin/jackup_cmd_shared.rb
|
197
200
|
- spec/bin/jackup_cmd_spec.rb
|
@@ -213,6 +216,7 @@ test_files:
|
|
213
216
|
- spec/lib/jackbox/patterns_spec.rb
|
214
217
|
- spec/lib/jackbox/prefs_spec.rb
|
215
218
|
- spec/lib/jackbox/reclassing_spec.rb
|
219
|
+
- spec/lib/jackbox/vmc_spec.rb
|
216
220
|
- spec/lib/jackbox_spec.rb
|
217
221
|
- spec/spec_helper.rb
|
218
222
|
has_rdoc:
|