rubybreaker 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +3 -0
- data/README.md +1 -2
- data/Rakefile +1 -0
- data/TODO +0 -8
- data/TUTORIAL.md +33 -7
- data/VERSION +1 -1
- data/lib/rubybreaker.rb +12 -4
- data/lib/rubybreaker/debug/error.rb +1 -1
- data/lib/rubybreaker/runtime.rb +16 -12
- data/lib/rubybreaker/runtime/monitor.rb +116 -84
- data/lib/rubybreaker/runtime/pluggable.rb +8 -2
- data/lib/rubybreaker/runtime/type_system.rb +77 -10
- data/lib/rubybreaker/task.rb +6 -0
- data/lib/rubybreaker/util.rb +23 -0
- data/test/integrated/tc_checking.rb +71 -0
- data/test/integrated/tc_class_methods.rb +14 -4
- data/test/testtask/sample.rb +1 -0
- data/test/testtask/tc_testtask.rb +14 -2
- data/test/ts_integrated.rb +1 -0
- data/webpage/index.html +1 -2
- data/webpage/rdoc/Object.html +0 -2
- data/webpage/rdoc/Rake.html +0 -2
- data/webpage/rdoc/Rake/RubyBreakerTestTask.html +19 -5
- data/webpage/rdoc/RubyBreaker.html +35 -3
- data/webpage/rdoc/RubyBreaker/Breakable.html +1 -3
- data/webpage/rdoc/RubyBreaker/Broken.html +1 -3
- data/webpage/rdoc/RubyBreaker/Context.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +2 -4
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +0 -2
- data/webpage/rdoc/RubyBreaker/Position.html +0 -2
- data/webpage/rdoc/RubyBreaker/RDocSupport.html +0 -2
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime.html +39 -6
- data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +295 -28
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +30 -43
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +4 -6
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +78 -18
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigUnparser.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +172 -28
- data/webpage/rdoc/RubyBreaker/TypeComparer.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +0 -2
- data/webpage/rdoc/RubyBreaker/Typing.html +0 -2
- data/webpage/rdoc/RubyBreaker/Util.html +80 -4
- data/webpage/rdoc/Test.html +0 -2
- data/webpage/rdoc/Test/Unit.html +0 -2
- data/webpage/rdoc/created.rid +12 -12
- data/webpage/rdoc/index.html +0 -2
- data/webpage/rdoc/js/search_index.js +1 -1
- data/webpage/rdoc/table_of_contents.html +53 -34
- data/webpage/tutorial.html +36 -7
- metadata +8 -11
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +0 -402
@@ -104,6 +104,8 @@
|
|
104
104
|
|
105
105
|
<li><a href="#method-c-breakable">::breakable</a>
|
106
106
|
|
107
|
+
<li><a href="#method-c-check">::check</a>
|
108
|
+
|
107
109
|
<li><a href="#method-c-defined_logger-3F">::defined_logger?</a>
|
108
110
|
|
109
111
|
<li><a href="#method-c-error">::error</a>
|
@@ -170,8 +172,6 @@
|
|
170
172
|
|
171
173
|
<li><a href="./RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
172
174
|
|
173
|
-
<li><a href="./RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
174
|
-
|
175
175
|
<li><a href="./RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
176
176
|
|
177
177
|
<li><a href="./RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -372,6 +372,36 @@ of entry.</p>
|
|
372
372
|
</div><!-- breakable-method -->
|
373
373
|
|
374
374
|
|
375
|
+
<div id="method-c-check" class="method-detail ">
|
376
|
+
|
377
|
+
<div class="method-heading">
|
378
|
+
<span class="method-name">check</span><span
|
379
|
+
class="method-args">(*mods)</span>
|
380
|
+
<span class="method-click-advice">click to toggle source</span>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
|
384
|
+
<div class="method-description">
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
<div class="method-source-code" id="check-source">
|
391
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line 97</span>
|
392
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">check</span>(*<span class="ruby-identifier">mods</span>)
|
393
|
+
<span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">check</span>(*<span class="ruby-identifier">mods</span>)
|
394
|
+
<span class="ruby-keyword">end</span></pre>
|
395
|
+
</div><!-- check-source -->
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
</div><!-- check-method -->
|
403
|
+
|
404
|
+
|
375
405
|
<div id="method-c-defined_logger-3F" class="method-detail ">
|
376
406
|
|
377
407
|
<div class="method-heading">
|
@@ -527,7 +557,7 @@ href="RubyBreaker.html">RubyBreaker</a> as a shell program.</p>
|
|
527
557
|
|
528
558
|
|
529
559
|
<div class="method-source-code" id="run-source">
|
530
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line
|
560
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 171</span>
|
531
561
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run</span>(*<span class="ruby-identifier">mods</span>)
|
532
562
|
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">setup_logger</span>() <span class="ruby-keyword">unless</span> <span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">defined_logger?</span>()
|
533
563
|
|
@@ -538,12 +568,14 @@ href="RubyBreaker.html">RubyBreaker</a> as a shell program.</p>
|
|
538
568
|
<span class="ruby-identifier">task</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">task</span>
|
539
569
|
<span class="ruby-constant">OPTION_PARSER</span>.<span class="ruby-identifier">parse</span>(*<span class="ruby-identifier">task</span>[<span class="ruby-value">:rubybreaker_opts</span>])
|
540
570
|
<span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">break</span>(*<span class="ruby-identifier">task</span>[<span class="ruby-value">:break</span>])
|
571
|
+
<span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">check</span>(*<span class="ruby-identifier">task</span>[<span class="ruby-value">:check</span>])
|
541
572
|
<span class="ruby-identifier">task_name</span> = <span class="ruby-identifier">task</span>[<span class="ruby-value">:name</span>]
|
542
573
|
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Done reading task information"</span>)
|
543
574
|
<span class="ruby-identifier">io_file</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">io_file</span>(<span class="ruby-identifier">task_name</span>)
|
544
575
|
<span class="ruby-keyword">elsif</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:prog</span>] <span class="ruby-comment"># running in shell mode </span>
|
545
576
|
<span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">break</span>(*<span class="ruby-identifier">mods</span>) <span class="ruby-comment"># should not happen but for backward-compatibility</span>
|
546
577
|
<span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">break</span>(*<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:break</span>])
|
578
|
+
<span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">check</span>(*<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:check</span>])
|
547
579
|
<span class="ruby-identifier">io_file</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">io_file</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:prog_file</span>])
|
548
580
|
<span class="ruby-keyword">else</span>
|
549
581
|
<span class="ruby-comment"># Otherwise, assume there are no explicit IO files.</span>
|
@@ -120,8 +120,6 @@
|
|
120
120
|
|
121
121
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
122
122
|
|
123
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
124
|
-
|
125
123
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
126
124
|
|
127
125
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -231,7 +229,7 @@ or +<a href="../RubyBreaker.html#method-c-run">RubyBreaker.run</a>+ method</p>
|
|
231
229
|
|
232
230
|
|
233
231
|
<div class="method-source-code" id="included-source">
|
234
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line
|
232
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line 104</span>
|
235
233
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">mod</span>)
|
236
234
|
<span class="ruby-constant">Runtime</span><span class="ruby-operator">::</span><span class="ruby-constant">BREAKABLES</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">mod</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">eigen_class</span>(<span class="ruby-identifier">mod</span>)
|
237
235
|
<span class="ruby-keyword">end</span></pre>
|
@@ -120,8 +120,6 @@
|
|
120
120
|
|
121
121
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
122
122
|
|
123
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
124
|
-
|
125
123
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
126
124
|
|
127
125
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -227,7 +225,7 @@
|
|
227
225
|
|
228
226
|
|
229
227
|
<div class="method-source-code" id="included-source">
|
230
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line
|
228
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line 111</span>
|
231
229
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">mod</span>)
|
232
230
|
<span class="ruby-comment"># Runtime.broken(mod)</span>
|
233
231
|
<span class="ruby-keyword">end</span></pre>
|
@@ -132,8 +132,6 @@
|
|
132
132
|
|
133
133
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
134
134
|
|
135
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
136
|
-
|
137
135
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
138
136
|
|
139
137
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -110,8 +110,6 @@
|
|
110
110
|
|
111
111
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
112
112
|
|
113
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
114
|
-
|
115
113
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
116
114
|
|
117
115
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -126,8 +126,6 @@
|
|
126
126
|
|
127
127
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
128
128
|
|
129
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
130
|
-
|
131
129
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
132
130
|
|
133
131
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -126,8 +126,6 @@
|
|
126
126
|
|
127
127
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
128
128
|
|
129
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
130
|
-
|
131
129
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
132
130
|
|
133
131
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -116,8 +116,6 @@
|
|
116
116
|
|
117
117
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
118
118
|
|
119
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
120
|
-
|
121
119
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
122
120
|
|
123
121
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -116,8 +116,6 @@
|
|
116
116
|
|
117
117
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
118
118
|
|
119
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
120
|
-
|
121
119
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
122
120
|
|
123
121
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -116,8 +116,6 @@
|
|
116
116
|
|
117
117
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
118
118
|
|
119
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
120
|
-
|
121
119
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
122
120
|
|
123
121
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -126,8 +126,6 @@
|
|
126
126
|
|
127
127
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
128
128
|
|
129
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
130
|
-
|
131
129
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
132
130
|
|
133
131
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -224,7 +222,7 @@ errors tend to generate over multiple points in the program.</p>
|
|
224
222
|
|
225
223
|
<div class="method-heading">
|
226
224
|
<span class="method-name">new</span><span
|
227
|
-
class="method-args">(msg, ctx)</span>
|
225
|
+
class="method-args">(msg, ctx=nil)</span>
|
228
226
|
<span class="method-click-advice">click to toggle source</span>
|
229
227
|
</div>
|
230
228
|
|
@@ -237,7 +235,7 @@ errors tend to generate over multiple points in the program.</p>
|
|
237
235
|
|
238
236
|
<div class="method-source-code" id="new-source">
|
239
237
|
<pre><span class="ruby-comment"># File lib/rubybreaker/debug/error.rb, line 44</span>
|
240
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">ctx</span>)
|
238
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">ctx</span>=<span class="ruby-keyword">nil</span>)
|
241
239
|
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">msg</span>)
|
242
240
|
<span class="ruby-ivar">@ctx</span> = <span class="ruby-identifier">ctx</span>
|
243
241
|
<span class="ruby-keyword">end</span></pre>
|
@@ -128,8 +128,6 @@
|
|
128
128
|
|
129
129
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
130
130
|
|
131
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
132
|
-
|
133
131
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
134
132
|
|
135
133
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -134,8 +134,6 @@
|
|
134
134
|
|
135
135
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
136
136
|
|
137
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
138
|
-
|
139
137
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
140
138
|
|
141
139
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -134,8 +134,6 @@
|
|
134
134
|
|
135
135
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
136
136
|
|
137
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
138
|
-
|
139
137
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
140
138
|
|
141
139
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -122,8 +122,6 @@
|
|
122
122
|
|
123
123
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
124
124
|
|
125
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
126
|
-
|
127
125
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
128
126
|
|
129
127
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -77,6 +77,8 @@
|
|
77
77
|
|
78
78
|
<li><a href="#method-c-breakable">::breakable</a>
|
79
79
|
|
80
|
+
<li><a href="#method-c-check">::check</a>
|
81
|
+
|
80
82
|
<li><a href="#method-c-instrument">::instrument</a>
|
81
83
|
|
82
84
|
</ul>
|
@@ -133,8 +135,6 @@
|
|
133
135
|
|
134
136
|
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
135
137
|
|
136
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
137
|
-
|
138
138
|
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
139
139
|
|
140
140
|
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -202,6 +202,8 @@
|
|
202
202
|
|
203
203
|
<div id="description" class="description">
|
204
204
|
|
205
|
+
<p>This module contains things that are needed at runtime.</p>
|
206
|
+
|
205
207
|
</div><!-- description -->
|
206
208
|
|
207
209
|
|
@@ -235,7 +237,7 @@ href="../RubyBreaker.html">RubyBreaker</a> code.</p>
|
|
235
237
|
|
236
238
|
<dt id="DEFAULT_TYPE_SYSTEM">DEFAULT_TYPE_SYSTEM
|
237
239
|
|
238
|
-
<dd class="description">
|
240
|
+
<dd class="description"><p>The default type system for <a href="../RubyBreaker.html">RubyBreaker</a></p>
|
239
241
|
|
240
242
|
|
241
243
|
<dt id="GLOBAL_MONITOR_SWITCH">GLOBAL_MONITOR_SWITCH
|
@@ -293,12 +295,12 @@ non-breakable modules/classes.</p>
|
|
293
295
|
<div class="method-description">
|
294
296
|
|
295
297
|
<p>This method instruments the specified modules/classes at the time of the
|
296
|
-
call.</p>
|
298
|
+
call so they are monitored for type documentation.</p>
|
297
299
|
|
298
300
|
|
299
301
|
|
300
302
|
<div class="method-source-code" id="break-source">
|
301
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line
|
303
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line 54</span>
|
302
304
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-keyword">break</span>(*<span class="ruby-identifier">mods</span>)
|
303
305
|
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">install</span>(<span class="ruby-value">:break</span>, *<span class="ruby-identifier">mods</span>)
|
304
306
|
<span class="ruby-keyword">end</span></pre>
|
@@ -344,6 +346,37 @@ method instead</p>
|
|
344
346
|
</div><!-- breakable-method -->
|
345
347
|
|
346
348
|
|
349
|
+
<div id="method-c-check" class="method-detail ">
|
350
|
+
|
351
|
+
<div class="method-heading">
|
352
|
+
<span class="method-name">check</span><span
|
353
|
+
class="method-args">(*mods)</span>
|
354
|
+
<span class="method-click-advice">click to toggle source</span>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
|
358
|
+
<div class="method-description">
|
359
|
+
|
360
|
+
<p>This method instruments the specified modules/classes at the time of the
|
361
|
+
call so that they are type checked during runtime.</p>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
<div class="method-source-code" id="check-source">
|
366
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime.rb, line 60</span>
|
367
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">check</span>(*<span class="ruby-identifier">mods</span>)
|
368
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">install</span>(<span class="ruby-value">:check</span>, *<span class="ruby-identifier">mods</span>)
|
369
|
+
<span class="ruby-keyword">end</span></pre>
|
370
|
+
</div><!-- check-source -->
|
371
|
+
|
372
|
+
</div>
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</div><!-- check-method -->
|
378
|
+
|
379
|
+
|
347
380
|
<div id="method-c-instrument" class="method-detail ">
|
348
381
|
|
349
382
|
<div class="method-heading">
|
@@ -365,7 +398,7 @@ method instead</p>
|
|
365
398
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">instrument</span>()
|
366
399
|
<span class="ruby-constant">BREAKABLES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
|
367
400
|
<span class="ruby-comment"># Duplicate checks in place in these calls.</span>
|
368
|
-
<span class="ruby-constant">MonitorInstaller</span>.<span class="ruby-identifier">install_monitor</span>(<span class="ruby-identifier">mod</span>)
|
401
|
+
<span class="ruby-constant">MonitorInstaller</span>.<span class="ruby-identifier">install_monitor</span>(<span class="ruby-value">:break</span>, <span class="ruby-identifier">mod</span>)
|
369
402
|
<span class="ruby-keyword">end</span>
|
370
403
|
<span class="ruby-keyword">end</span></pre>
|
371
404
|
</div><!-- instrument-source -->
|
@@ -126,8 +126,6 @@
|
|
126
126
|
|
127
127
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
128
128
|
|
129
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
130
|
-
|
131
129
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
132
130
|
|
133
131
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -126,8 +126,6 @@
|
|
126
126
|
|
127
127
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
128
128
|
|
129
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
130
|
-
|
131
129
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
132
130
|
|
133
131
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -70,11 +70,21 @@
|
|
70
70
|
|
71
71
|
<ul class="link-list">
|
72
72
|
|
73
|
+
<li><a href="#method-c-get_alt_meth_name">::get_alt_meth_name</a>
|
74
|
+
|
75
|
+
<li><a href="#method-c-get_orig_meth_name">::get_orig_meth_name</a>
|
76
|
+
|
73
77
|
<li><a href="#method-c-new">::new</a>
|
74
78
|
|
75
|
-
<li><a href="#method-
|
79
|
+
<li><a href="#method-c-route">::route</a>
|
80
|
+
|
81
|
+
<li><a href="#method-i-break_after_method">#break_after_method</a>
|
82
|
+
|
83
|
+
<li><a href="#method-i-break_before_method">#break_before_method</a>
|
76
84
|
|
77
|
-
<li><a href="#method-i-
|
85
|
+
<li><a href="#method-i-check_after_method">#check_after_method</a>
|
86
|
+
|
87
|
+
<li><a href="#method-i-check_before_method">#check_before_method</a>
|
78
88
|
|
79
89
|
</ul>
|
80
90
|
</nav>
|
@@ -130,8 +140,6 @@
|
|
130
140
|
|
131
141
|
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
132
142
|
|
133
|
-
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
134
|
-
|
135
143
|
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
136
144
|
|
137
145
|
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
@@ -229,7 +237,7 @@ actual work of gathering type information.</p>
|
|
229
237
|
|
230
238
|
<div class="method-description">
|
231
239
|
|
232
|
-
|
240
|
+
|
233
241
|
|
234
242
|
</div>
|
235
243
|
</div>
|
@@ -243,11 +251,71 @@ actual work of gathering type information.</p>
|
|
243
251
|
<h3 class="section-header">Public Class Methods</h3>
|
244
252
|
|
245
253
|
|
254
|
+
<div id="method-c-get_alt_meth_name" class="method-detail ">
|
255
|
+
|
256
|
+
<div class="method-heading">
|
257
|
+
<span class="method-name">get_alt_meth_name</span><span
|
258
|
+
class="method-args">(meth_name)</span>
|
259
|
+
<span class="method-click-advice">click to toggle source</span>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
|
263
|
+
<div class="method-description">
|
264
|
+
|
265
|
+
<p>This method returns the alternative (renamed) method name</p>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<div class="method-source-code" id="get_alt_meth_name-source">
|
270
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 145</span>
|
271
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_alt_meth_name</span>(<span class="ruby-identifier">meth_name</span>)
|
272
|
+
<span class="ruby-keyword">return</span> <span class="ruby-node">"__#{meth_name}"</span>
|
273
|
+
<span class="ruby-keyword">end</span></pre>
|
274
|
+
</div><!-- get_alt_meth_name-source -->
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
</div><!-- get_alt_meth_name-method -->
|
282
|
+
|
283
|
+
|
284
|
+
<div id="method-c-get_orig_meth_name" class="method-detail ">
|
285
|
+
|
286
|
+
<div class="method-heading">
|
287
|
+
<span class="method-name">get_orig_meth_name</span><span
|
288
|
+
class="method-args">(meth_name)</span>
|
289
|
+
<span class="method-click-advice">click to toggle source</span>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
|
293
|
+
<div class="method-description">
|
294
|
+
|
295
|
+
<p>This method returns the original method name</p>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
<div class="method-source-code" id="get_orig_meth_name-source">
|
300
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 150</span>
|
301
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_orig_meth_name</span>(<span class="ruby-identifier">meth_name</span>)
|
302
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">meth_name</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
303
|
+
<span class="ruby-keyword">end</span></pre>
|
304
|
+
</div><!-- get_orig_meth_name-source -->
|
305
|
+
|
306
|
+
</div>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
</div><!-- get_orig_meth_name-method -->
|
312
|
+
|
313
|
+
|
246
314
|
<div id="method-c-new" class="method-detail ">
|
247
315
|
|
248
316
|
<div class="method-heading">
|
249
317
|
<span class="method-name">new</span><span
|
250
|
-
class="method-args">(
|
318
|
+
class="method-args">(pluggable)</span>
|
251
319
|
<span class="method-click-advice">click to toggle source</span>
|
252
320
|
</div>
|
253
321
|
|
@@ -259,9 +327,8 @@ actual work of gathering type information.</p>
|
|
259
327
|
|
260
328
|
|
261
329
|
<div class="method-source-code" id="new-source">
|
262
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
263
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">
|
264
|
-
<span class="ruby-comment"># @mod = mod</span>
|
330
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 154</span>
|
331
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">pluggable</span>)
|
265
332
|
<span class="ruby-ivar">@pluggable</span> = <span class="ruby-identifier">pluggable</span>
|
266
333
|
<span class="ruby-keyword">end</span></pre>
|
267
334
|
</div><!-- new-source -->
|
@@ -274,16 +341,217 @@ actual work of gathering type information.</p>
|
|
274
341
|
</div><!-- new-method -->
|
275
342
|
|
276
343
|
|
344
|
+
<div id="method-c-route" class="method-detail ">
|
345
|
+
|
346
|
+
<div class="method-heading">
|
347
|
+
<span class="method-name">route</span><span
|
348
|
+
class="method-args">(route_type, obj, meth_name, *args, &blk)</span>
|
349
|
+
<span class="method-click-advice">click to toggle source</span>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
|
353
|
+
<div class="method-description">
|
354
|
+
|
355
|
+
<p>This will do the actual routing work for a particular “monitored” method
|
356
|
+
call.</p>
|
357
|
+
<dl class="rdoc-list note-list"><dt>route_type
|
358
|
+
<dd>
|
359
|
+
<p>:break or :check</p>
|
360
|
+
</dd><dt>obj
|
361
|
+
<dd>
|
362
|
+
<p>is the object receiving the message; is never wrapped object</p>
|
363
|
+
</dd><dt>meth_name
|
364
|
+
<dd><dl class="rdoc-list note-list"><dt>is the original method name being called args
|
365
|
+
<dd>
|
366
|
+
<p>is a</p>
|
367
|
+
</dd></dl>
|
368
|
+
</dd><dt>list of arguments for the original method call blk
|
369
|
+
<dd>
|
370
|
+
<p>is the block</p>
|
371
|
+
</dd></dl>
|
372
|
+
|
373
|
+
<p>argument for the original method call</p>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
<div class="method-source-code" id="route-source">
|
378
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 47</span>
|
379
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">route</span>(<span class="ruby-identifier">route_type</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_name</span>, *<span class="ruby-identifier">args</span>, &<span class="ruby-identifier">blk</span>)
|
380
|
+
|
381
|
+
<span class="ruby-comment"># remember the switch mode before turning it off</span>
|
382
|
+
<span class="ruby-identifier">switch</span> = <span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">switch</span>
|
383
|
+
|
384
|
+
<span class="ruby-comment"># turn off the monitor so we do not fall into an infinite loop</span>
|
385
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_off</span>()
|
386
|
+
|
387
|
+
<span class="ruby-comment"># use symbol instead of string throughout this code</span>
|
388
|
+
<span class="ruby-identifier">meth_name</span> = <span class="ruby-value">:"#{meth_name}"</span>
|
389
|
+
|
390
|
+
<span class="ruby-comment"># first, get the context right</span>
|
391
|
+
<span class="ruby-comment"># notice the argument 2 to the caller!</span>
|
392
|
+
<span class="ruby-comment">#</span>
|
393
|
+
<span class="ruby-comment"># CONTEXT.push(obj, meth_name, </span>
|
394
|
+
<span class="ruby-comment"># Position.convert_caller_to_pos(caller(2)))</span>
|
395
|
+
<span class="ruby-constant">CONTEXT</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Position</span>.<span class="ruby-identifier">convert_caller_to_pos</span>(<span class="ruby-identifier">caller</span>(<span class="ruby-value">2</span>)))
|
396
|
+
|
397
|
+
<span class="ruby-comment"># this is what the renamed method</span>
|
398
|
+
<span class="ruby-identifier">stub_meth_name</span> = <span class="ruby-identifier">get_alt_meth_name</span>(<span class="ruby-identifier">meth_name</span>)
|
399
|
+
|
400
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Route to #{stub_meth_name}"</span>, <span class="ruby-value">:debug</span>, <span class="ruby-constant">CONTEXT</span>)
|
401
|
+
|
402
|
+
<span class="ruby-comment"># short-circuit if switch was off--i.e., no monitoring</span>
|
403
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch</span>
|
404
|
+
<span class="ruby-identifier">retval</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">stub_meth_name</span>.<span class="ruby-identifier">to_sym</span>,*<span class="ruby-identifier">args</span>,&<span class="ruby-identifier">blk</span>)
|
405
|
+
<span class="ruby-constant">CONTEXT</span>.<span class="ruby-identifier">pop</span>() <span class="ruby-comment"># do not forget to pop the context before returning</span>
|
406
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">retval</span>
|
407
|
+
<span class="ruby-keyword">end</span>
|
408
|
+
|
409
|
+
<span class="ruby-identifier">is_obj_mod</span> = (<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Class</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Module</span>)
|
410
|
+
<span class="ruby-identifier">mod</span> = <span class="ruby-identifier">is_obj_mod</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">eigen_class</span>(<span class="ruby-identifier">obj</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>
|
411
|
+
|
412
|
+
<span class="ruby-comment"># mm = get_module_monitor(mod) unless is_obj_mod</span>
|
413
|
+
<span class="ruby-identifier">mm</span> = <span class="ruby-constant">MONITOR_MAP</span>[<span class="ruby-identifier">mod</span>]
|
414
|
+
|
415
|
+
<span class="ruby-comment"># There is something wrong if there isn't a module monitor</span>
|
416
|
+
<span class="ruby-comment"># associated with the call.</span>
|
417
|
+
<span class="ruby-comment"># raise Exception if mm == nil || !mm.include?(meth_name)</span>
|
418
|
+
|
419
|
+
<span class="ruby-identifier">meth_info</span> = <span class="ruby-constant">MethodInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">meth_name</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">blk</span>, <span class="ruby-keyword">nil</span>)
|
420
|
+
|
421
|
+
<span class="ruby-keyword">begin</span>
|
422
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">route_type</span>
|
423
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:break</span>
|
424
|
+
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">break_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
425
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:check</span>
|
426
|
+
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">check_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
427
|
+
<span class="ruby-keyword">end</span>
|
428
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">TypeError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
429
|
+
<span class="ruby-comment"># Trap it, turn on the global monitor and then re-raise the</span>
|
430
|
+
<span class="ruby-comment"># exception</span>
|
431
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
432
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
433
|
+
<span class="ruby-keyword">end</span>
|
434
|
+
|
435
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"break_before_method ended"</span>)
|
436
|
+
|
437
|
+
<span class="ruby-comment"># we are going to turn the switch back on</span>
|
438
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
439
|
+
|
440
|
+
<span class="ruby-comment"># call the original method which was renamed</span>
|
441
|
+
<span class="ruby-identifier">retval</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">stub_meth_name</span>.<span class="ruby-identifier">to_sym</span>, *<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">args</span>,
|
442
|
+
&<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">blk</span>)
|
443
|
+
|
444
|
+
<span class="ruby-comment"># turn it off</span>
|
445
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_off</span>()
|
446
|
+
|
447
|
+
<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">retval</span>
|
448
|
+
|
449
|
+
<span class="ruby-keyword">begin</span>
|
450
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">route_type</span>
|
451
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:break</span>
|
452
|
+
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">break_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
453
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:check</span>
|
454
|
+
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">check_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
455
|
+
<span class="ruby-keyword">end</span>
|
456
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">TypeError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
457
|
+
<span class="ruby-comment"># Trap it, turn on the global monitor and then re-raise the</span>
|
458
|
+
<span class="ruby-comment"># exception</span>
|
459
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
460
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
461
|
+
<span class="ruby-keyword">end</span>
|
462
|
+
|
463
|
+
<span class="ruby-identifier">retval</span> = <span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">ret</span> <span class="ruby-comment"># Return value may have been altered by the</span>
|
464
|
+
<span class="ruby-comment"># after_method monitoring code</span>
|
465
|
+
|
466
|
+
<span class="ruby-comment"># things are done in this context. pop it off.</span>
|
467
|
+
<span class="ruby-constant">CONTEXT</span>.<span class="ruby-identifier">pop</span>()
|
468
|
+
|
469
|
+
<span class="ruby-comment"># it is always the case that the switch was off when this particular</span>
|
470
|
+
<span class="ruby-comment"># call was made. (Otherwise, it would have quit somewhere above</span>
|
471
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
472
|
+
|
473
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">retval</span> <span class="ruby-comment"># always return the return value</span>
|
474
|
+
<span class="ruby-keyword">end</span></pre>
|
475
|
+
</div><!-- route-source -->
|
476
|
+
|
477
|
+
</div>
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
</div><!-- route-method -->
|
483
|
+
|
484
|
+
|
277
485
|
</section><!-- public-class-method-details -->
|
278
486
|
|
279
487
|
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
280
488
|
<h3 class="section-header">Public Instance Methods</h3>
|
281
489
|
|
282
490
|
|
283
|
-
<div id="method-i-
|
491
|
+
<div id="method-i-break_after_method" class="method-detail ">
|
492
|
+
|
493
|
+
<div class="method-heading">
|
494
|
+
<span class="method-name">break_after_method</span><span
|
495
|
+
class="method-args">(obj, meth_info)</span>
|
496
|
+
<span class="method-click-advice">click to toggle source</span>
|
497
|
+
</div>
|
498
|
+
|
499
|
+
|
500
|
+
<div class="method-description">
|
501
|
+
|
502
|
+
<p>This method is invoked after the original method is executed.</p>
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
<div class="method-source-code" id="break_after_method-source">
|
507
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 174</span>
|
508
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">break_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
509
|
+
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">break_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
510
|
+
<span class="ruby-keyword">end</span></pre>
|
511
|
+
</div><!-- break_after_method-source -->
|
512
|
+
|
513
|
+
</div>
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
</div><!-- break_after_method-method -->
|
519
|
+
|
520
|
+
|
521
|
+
<div id="method-i-break_before_method" class="method-detail ">
|
522
|
+
|
523
|
+
<div class="method-heading">
|
524
|
+
<span class="method-name">break_before_method</span><span
|
525
|
+
class="method-args">(obj, meth_info)</span>
|
526
|
+
<span class="method-click-advice">click to toggle source</span>
|
527
|
+
</div>
|
528
|
+
|
529
|
+
|
530
|
+
<div class="method-description">
|
531
|
+
|
532
|
+
<p>This method is invoked before the original method is executed.</p>
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
<div class="method-source-code" id="break_before_method-source">
|
537
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 169</span>
|
538
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">break_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
539
|
+
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">break_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
540
|
+
<span class="ruby-keyword">end</span></pre>
|
541
|
+
</div><!-- break_before_method-source -->
|
542
|
+
|
543
|
+
</div>
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
</div><!-- break_before_method-method -->
|
549
|
+
|
550
|
+
|
551
|
+
<div id="method-i-check_after_method" class="method-detail ">
|
284
552
|
|
285
553
|
<div class="method-heading">
|
286
|
-
<span class="method-name">
|
554
|
+
<span class="method-name">check_after_method</span><span
|
287
555
|
class="method-args">(obj, meth_info)</span>
|
288
556
|
<span class="method-click-advice">click to toggle source</span>
|
289
557
|
</div>
|
@@ -291,29 +559,29 @@ actual work of gathering type information.</p>
|
|
291
559
|
|
292
560
|
<div class="method-description">
|
293
561
|
|
294
|
-
<p>This method is invoked after the
|
562
|
+
<p>This method is invoked after the original method is executed.</p>
|
295
563
|
|
296
564
|
|
297
565
|
|
298
|
-
<div class="method-source-code" id="
|
299
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
300
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
301
|
-
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">
|
566
|
+
<div class="method-source-code" id="check_after_method-source">
|
567
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 164</span>
|
568
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">check_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
569
|
+
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">check_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
302
570
|
<span class="ruby-keyword">end</span></pre>
|
303
|
-
</div><!--
|
571
|
+
</div><!-- check_after_method-source -->
|
304
572
|
|
305
573
|
</div>
|
306
574
|
|
307
575
|
|
308
576
|
|
309
577
|
|
310
|
-
</div><!--
|
578
|
+
</div><!-- check_after_method-method -->
|
311
579
|
|
312
580
|
|
313
|
-
<div id="method-i-
|
581
|
+
<div id="method-i-check_before_method" class="method-detail ">
|
314
582
|
|
315
583
|
<div class="method-heading">
|
316
|
-
<span class="method-name">
|
584
|
+
<span class="method-name">check_before_method</span><span
|
317
585
|
class="method-args">(obj, meth_info)</span>
|
318
586
|
<span class="method-click-advice">click to toggle source</span>
|
319
587
|
</div>
|
@@ -321,24 +589,23 @@ actual work of gathering type information.</p>
|
|
321
589
|
|
322
590
|
<div class="method-description">
|
323
591
|
|
324
|
-
<p>
|
325
|
-
gather type information in the callee.</p>
|
592
|
+
<p>This method is invoked before the original method is executed.</p>
|
326
593
|
|
327
594
|
|
328
595
|
|
329
|
-
<div class="method-source-code" id="
|
330
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
331
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">
|
332
|
-
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">
|
596
|
+
<div class="method-source-code" id="check_before_method-source">
|
597
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 159</span>
|
598
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">check_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
599
|
+
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">check_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
333
600
|
<span class="ruby-keyword">end</span></pre>
|
334
|
-
</div><!--
|
601
|
+
</div><!-- check_before_method-source -->
|
335
602
|
|
336
603
|
</div>
|
337
604
|
|
338
605
|
|
339
606
|
|
340
607
|
|
341
|
-
</div><!--
|
608
|
+
</div><!-- check_before_method-method -->
|
342
609
|
|
343
610
|
|
344
611
|
</section><!-- public-instance-method-details -->
|