rubybreaker 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +6 -0
- data/VERSION +1 -1
- data/bin/rubybreaker +3 -3
- data/lib/rubybreaker.rb +15 -11
- data/lib/rubybreaker/doc/rdoc.rb +1 -1
- data/lib/rubybreaker/runtime/monitor.rb +8 -6
- data/lib/rubybreaker/runtime/object_wrapper.rb +38 -16
- data/lib/rubybreaker/runtime/overrides.rb +42 -30
- data/lib/rubybreaker/runtime/type_system.rb +45 -14
- data/lib/rubybreaker/type/type_unparser.rb +4 -8
- data/lib/rubybreaker/typing/subtyping.rb +1 -0
- data/test/integrated/tc_original_behavior.rb +38 -0
- data/test/integrated/tc_simple1.rb +20 -0
- data/test/integrated/tc_simple_algorithms.rb +135 -0
- data/test/runtime/tc_obj_wrapper.rb +3 -3
- data/test/ts_integrated.rb +1 -0
- data/test/type/tc_parser.rb +24 -0
- data/webpage/rdoc/Object.html +0 -2
- data/webpage/rdoc/Rake.html +0 -2
- data/webpage/rdoc/Rake/RubyBreakerTestTask.html +0 -2
- data/webpage/rdoc/RubyBreaker.html +1 -3
- data/webpage/rdoc/RubyBreaker/Breakable.html +0 -2
- data/webpage/rdoc/RubyBreaker/Broken.html +0 -2
- data/webpage/rdoc/RubyBreaker/Context.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/ArgumentTypeError.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/ArityError.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/ReturnTypeError.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +0 -2
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +0 -2
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +0 -2
- data/webpage/rdoc/RubyBreaker/Position.html +0 -2
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +0 -2
- data/webpage/rdoc/RubyBreaker/Runtime.html +7 -3
- 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 +12 -13
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +6 -7
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +4 -6
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +21 -19
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +0 -2
- 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 +52 -23
- 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 +2 -4
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +0 -2
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +1 -3
- data/webpage/rdoc/RubyBreaker/Typing.html +1 -3
- data/webpage/rdoc/RubyBreaker/Util.html +0 -2
- data/webpage/rdoc/Test.html +0 -2
- data/webpage/rdoc/Test/Unit.html +0 -2
- data/webpage/rdoc/created.rid +10 -10
- data/webpage/rdoc/index.html +0 -2
- data/webpage/rdoc/js/search_index.js +1 -1
- data/webpage/rdoc/table_of_contents.html +31 -38
- metadata +3 -3
- data/webpage/rdoc/RubyBreaker/RDocSupport.html +0 -328
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
116
116
|
|
117
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
118
|
-
|
119
117
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
120
118
|
|
121
119
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
116
116
|
|
117
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
118
|
-
|
119
117
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
120
118
|
|
121
119
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -104,8 +104,6 @@
|
|
104
104
|
|
105
105
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
106
106
|
|
107
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
108
|
-
|
109
107
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
110
108
|
|
111
109
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -104,8 +104,6 @@
|
|
104
104
|
|
105
105
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
106
106
|
|
107
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
108
|
-
|
109
107
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
110
108
|
|
111
109
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -104,8 +104,6 @@
|
|
104
104
|
|
105
105
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
106
106
|
|
107
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
108
|
-
|
109
107
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
110
108
|
|
111
109
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
116
116
|
|
117
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
118
|
-
|
119
117
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
120
118
|
|
121
119
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -116,8 +116,6 @@
|
|
116
116
|
|
117
117
|
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
118
118
|
|
119
|
-
<li><a href="../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
120
|
-
|
121
119
|
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
122
120
|
|
123
121
|
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -122,8 +122,6 @@
|
|
122
122
|
|
123
123
|
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
124
124
|
|
125
|
-
<li><a href="../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
126
|
-
|
127
125
|
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
128
126
|
|
129
127
|
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -110,8 +110,6 @@
|
|
110
110
|
|
111
111
|
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
112
112
|
|
113
|
-
<li><a href="../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
114
|
-
|
115
113
|
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
116
114
|
|
117
115
|
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -123,8 +123,6 @@
|
|
123
123
|
|
124
124
|
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
125
125
|
|
126
|
-
<li><a href="../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
127
|
-
|
128
126
|
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
129
127
|
|
130
128
|
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -226,7 +224,7 @@
|
|
226
224
|
|
227
225
|
<dt id="BLACKLIST">BLACKLIST
|
228
226
|
|
229
|
-
<dd class="description"><p>Prohibit these module/class+method from being overriden
|
227
|
+
<dd class="description"><p>Prohibit these module/class+method from being overriden.</p>
|
230
228
|
|
231
229
|
|
232
230
|
<dt id="BREAKABLES">BREAKABLES
|
@@ -275,6 +273,12 @@ method type. This hash is shared between breakable modules/classes and
|
|
275
273
|
non-breakable modules/classes.</p>
|
276
274
|
|
277
275
|
|
276
|
+
<dt id="WHITELIST">WHITELIST
|
277
|
+
|
278
|
+
<dd class="description"><p>Allow certain methods of these classes/modules to be overrriden. That is,
|
279
|
+
they will take unwrapped arguments whatsoever.</p>
|
280
|
+
|
281
|
+
|
278
282
|
<dt id="WRAPPED_INDICATOR">WRAPPED_INDICATOR
|
279
283
|
|
280
284
|
<dd class="description"><p>This constant is used to determine if an object is a wrapped object.</p>
|
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
116
116
|
|
117
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
118
|
-
|
119
117
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
120
118
|
|
121
119
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
116
116
|
|
117
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
118
|
-
|
119
117
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
120
118
|
|
121
119
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -128,8 +128,6 @@
|
|
128
128
|
|
129
129
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
130
130
|
|
131
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
132
|
-
|
133
131
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
134
132
|
|
135
133
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -271,9 +269,9 @@ actual work of gathering type information.</p>
|
|
271
269
|
|
272
270
|
|
273
271
|
<div class="method-source-code" id="get_alt_meth_name-source">
|
274
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
272
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 146</span>
|
275
273
|
<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>)
|
276
|
-
<span class="ruby-keyword">return</span> <span class="ruby-node">"
|
274
|
+
<span class="ruby-keyword">return</span> <span class="ruby-node">"__rubybreaker_#{meth_name}"</span>
|
277
275
|
<span class="ruby-keyword">end</span></pre>
|
278
276
|
</div><!-- get_alt_meth_name-source -->
|
279
277
|
|
@@ -301,7 +299,7 @@ actual work of gathering type information.</p>
|
|
301
299
|
|
302
300
|
|
303
301
|
<div class="method-source-code" id="get_orig_meth_name-source">
|
304
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
302
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 151</span>
|
305
303
|
<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>)
|
306
304
|
<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>]
|
307
305
|
<span class="ruby-keyword">end</span></pre>
|
@@ -331,7 +329,7 @@ actual work of gathering type information.</p>
|
|
331
329
|
|
332
330
|
|
333
331
|
<div class="method-source-code" id="new-source">
|
334
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
332
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 155</span>
|
335
333
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">pluggable</span>)
|
336
334
|
<span class="ruby-ivar">@pluggable</span> = <span class="ruby-identifier">pluggable</span>
|
337
335
|
<span class="ruby-keyword">end</span></pre>
|
@@ -430,14 +428,13 @@ call.</p>
|
|
430
428
|
<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>)
|
431
429
|
<span class="ruby-keyword">end</span>
|
432
430
|
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
431
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Exception #{e.class} has been raised."</span>, <span class="ruby-value">:debug</span>, <span class="ruby-constant">CONTEXT</span>)
|
433
432
|
<span class="ruby-comment"># Trap it, turn on the global monitor and then re-raise the</span>
|
434
433
|
<span class="ruby-comment"># exception</span>
|
435
434
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
436
435
|
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
437
436
|
<span class="ruby-keyword">end</span>
|
438
437
|
|
439
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"break_before_method ended"</span>)
|
440
|
-
|
441
438
|
<span class="ruby-comment"># we are going to turn the switch back on</span>
|
442
439
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
443
440
|
|
@@ -445,9 +442,10 @@ call.</p>
|
|
445
442
|
<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>,
|
446
443
|
&<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">blk</span>)
|
447
444
|
|
448
|
-
<span class="ruby-comment"># turn
|
445
|
+
<span class="ruby-comment"># turn the switch off again</span>
|
449
446
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_off</span>()
|
450
447
|
|
448
|
+
<span class="ruby-comment"># Remember the return value in the method info object.</span>
|
451
449
|
<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">retval</span>
|
452
450
|
|
453
451
|
<span class="ruby-keyword">begin</span>
|
@@ -460,6 +458,7 @@ call.</p>
|
|
460
458
|
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
461
459
|
<span class="ruby-comment"># Trap it, turn on the global monitor and then re-raise the</span>
|
462
460
|
<span class="ruby-comment"># exception</span>
|
461
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Exception #{e.class} has been raised."</span>, <span class="ruby-value">:debug</span>, <span class="ruby-constant">CONTEXT</span>)
|
463
462
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
464
463
|
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
465
464
|
<span class="ruby-keyword">end</span>
|
@@ -508,7 +507,7 @@ call.</p>
|
|
508
507
|
|
509
508
|
|
510
509
|
<div class="method-source-code" id="break_after_method-source">
|
511
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
510
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 175</span>
|
512
511
|
<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>)
|
513
512
|
<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>)
|
514
513
|
<span class="ruby-keyword">end</span></pre>
|
@@ -538,7 +537,7 @@ call.</p>
|
|
538
537
|
|
539
538
|
|
540
539
|
<div class="method-source-code" id="break_before_method-source">
|
541
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
540
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 170</span>
|
542
541
|
<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>)
|
543
542
|
<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>)
|
544
543
|
<span class="ruby-keyword">end</span></pre>
|
@@ -568,7 +567,7 @@ call.</p>
|
|
568
567
|
|
569
568
|
|
570
569
|
<div class="method-source-code" id="check_after_method-source">
|
571
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
570
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 165</span>
|
572
571
|
<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>)
|
573
572
|
<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>)
|
574
573
|
<span class="ruby-keyword">end</span></pre>
|
@@ -598,7 +597,7 @@ call.</p>
|
|
598
597
|
|
599
598
|
|
600
599
|
<div class="method-source-code" id="check_before_method-source">
|
601
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
600
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 160</span>
|
602
601
|
<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>)
|
603
602
|
<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>)
|
604
603
|
<span class="ruby-keyword">end</span></pre>
|
@@ -112,8 +112,6 @@
|
|
112
112
|
|
113
113
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
114
114
|
|
115
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
116
|
-
|
117
115
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
118
116
|
|
119
117
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -233,14 +231,14 @@
|
|
233
231
|
|
234
232
|
|
235
233
|
<div class="method-source-code" id="install_monitor-source">
|
236
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
234
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 239</span>
|
237
235
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">install_monitor</span>(<span class="ruby-identifier">monitor_type</span>, <span class="ruby-identifier">mod</span>)
|
238
236
|
|
239
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Installing
|
237
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Installing #{monitor_type} monitor for #{mod} started."</span>)
|
240
238
|
|
241
239
|
<span class="ruby-comment"># Do not re-install monitor if already done so.</span>
|
242
240
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">MONITOR_MAP</span>[<span class="ruby-identifier">mod</span>]
|
243
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"
|
241
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"#{mod} already has a monitor installed."</span>)
|
244
242
|
<span class="ruby-keyword">return</span>
|
245
243
|
<span class="ruby-keyword">end</span>
|
246
244
|
|
@@ -265,6 +263,7 @@
|
|
265
263
|
<span class="ruby-keyword">end</span>
|
266
264
|
<span class="ruby-keyword">end</span>
|
267
265
|
|
266
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Installing #{monitor_type} monitor for #{mod} ended."</span>)
|
268
267
|
<span class="ruby-keyword">end</span></pre>
|
269
268
|
</div><!-- install_monitor-source -->
|
270
269
|
|
@@ -292,7 +291,7 @@
|
|
292
291
|
|
293
292
|
|
294
293
|
<div class="method-source-code" id="is_module-3F-source">
|
295
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
294
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 220</span>
|
296
295
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">is_module?</span>(<span class="ruby-identifier">mod</span>)
|
297
296
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:class</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Module</span>)
|
298
297
|
<span class="ruby-keyword">end</span></pre>
|
@@ -323,7 +322,7 @@ monitor for the class</p>
|
|
323
322
|
|
324
323
|
|
325
324
|
<div class="method-source-code" id="monkey_patch_meth-source">
|
326
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
325
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 226</span>
|
327
326
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">monkey_patch_meth</span>(<span class="ruby-identifier">monitor_type</span>, <span class="ruby-identifier">mod</span>, <span class="ruby-identifier">meth_name</span>)
|
328
327
|
<span class="ruby-identifier">alt_meth_name</span> = <span class="ruby-constant">Monitor</span>.<span class="ruby-identifier">get_alt_meth_name</span>(<span class="ruby-identifier">meth_name</span>)
|
329
328
|
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">module_eval</span>(<span class="ruby-node">"alias :\"#{alt_meth_name}\" :\"#{meth_name}\""</span>)
|
@@ -120,8 +120,6 @@
|
|
120
120
|
|
121
121
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
122
122
|
|
123
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
124
|
-
|
125
123
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
126
124
|
|
127
125
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -263,7 +261,7 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
263
261
|
|
264
262
|
|
265
263
|
<div class="method-source-code" id="new-source">
|
266
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
264
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 188</span>
|
267
265
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(); <span class="ruby-ivar">@switch</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">end</span></pre>
|
268
266
|
</div><!-- new-source -->
|
269
267
|
|
@@ -297,7 +295,7 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
297
295
|
|
298
296
|
|
299
297
|
<div class="method-source-code" id="set_to-source">
|
300
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
298
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 200</span>
|
301
299
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">set_to</span>(<span class="ruby-identifier">mode</span>); <span class="ruby-ivar">@switch</span> = <span class="ruby-identifier">mode</span>; <span class="ruby-keyword">end</span></pre>
|
302
300
|
</div><!-- set_to-source -->
|
303
301
|
|
@@ -325,7 +323,7 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
325
323
|
|
326
324
|
|
327
325
|
<div class="method-source-code" id="turn_off-source">
|
328
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
326
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 195</span>
|
329
327
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">turn_off</span>();
|
330
328
|
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"Switch turned off"</span>)
|
331
329
|
<span class="ruby-ivar">@switch</span> = <span class="ruby-keyword">false</span>;
|
@@ -356,7 +354,7 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
356
354
|
|
357
355
|
|
358
356
|
<div class="method-source-code" id="turn_on-source">
|
359
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
357
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 190</span>
|
360
358
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">turn_on</span>();
|
361
359
|
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"Switch turned on"</span>)
|
362
360
|
<span class="ruby-ivar">@switch</span> = <span class="ruby-keyword">true</span>;
|
@@ -122,8 +122,6 @@
|
|
122
122
|
|
123
123
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
124
124
|
|
125
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
126
|
-
|
127
125
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
128
126
|
|
129
127
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -346,13 +344,13 @@ instance_exec</p>
|
|
346
344
|
|
347
345
|
|
348
346
|
<div class="method-source-code" id="method_missing-source">
|
349
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
347
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 88</span>
|
350
348
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">mname</span>,*<span class="ruby-identifier">args</span>,&<span class="ruby-identifier">blk</span>)
|
351
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Method_missing for #{mname}"</span>)
|
352
349
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">switch</span>
|
353
350
|
|
354
351
|
<span class="ruby-comment"># Be safe and turn the switch off</span>
|
355
352
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_off</span>
|
353
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Object wrapper method_missing for #{mname} started"</span>)
|
356
354
|
|
357
355
|
<span class="ruby-comment"># Must handle send method specially (do not track them)</span>
|
358
356
|
<span class="ruby-keyword">if</span> [<span class="ruby-value">:"__send__"</span>, <span class="ruby-value">:send</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mname</span>)
|
@@ -368,16 +366,18 @@ instance_exec</p>
|
|
368
366
|
<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-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-operator">::</span><span class="ruby-constant">Module</span>)
|
369
367
|
<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>
|
370
368
|
|
371
|
-
<span class="ruby-comment">#
|
372
|
-
<span class="ruby-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
<span class="ruby-
|
369
|
+
<span class="ruby-comment"># # There are certain methods that should not take wrapped</span>
|
370
|
+
<span class="ruby-comment"># # argument(s) whatsoever. Use WRAP_BLACKLIST for these.</span>
|
371
|
+
<span class="ruby-comment"># if !MONITOR_MAP[mod] && WRAP_BLACKLIST[mod] &&</span>
|
372
|
+
<span class="ruby-comment"># WRAP_BLACKLIST[mod].include?(mname)</span>
|
373
|
+
<span class="ruby-comment"># args.map! do |arg|</span>
|
374
|
+
<span class="ruby-comment"># if arg.respond_to?(WRAPPED_INDICATOR)</span>
|
375
|
+
<span class="ruby-comment"># arg.__rubybreaker_obj</span>
|
376
|
+
<span class="ruby-comment"># else</span>
|
377
|
+
<span class="ruby-comment"># arg</span>
|
378
|
+
<span class="ruby-comment"># end</span>
|
379
|
+
<span class="ruby-comment"># end</span>
|
380
|
+
<span class="ruby-comment"># end</span>
|
381
381
|
|
382
382
|
<span class="ruby-comment"># Turn on the global switch again</span>
|
383
383
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>
|
@@ -385,13 +385,15 @@ instance_exec</p>
|
|
385
385
|
<span class="ruby-comment"># And call the original method </span>
|
386
386
|
<span class="ruby-identifier">retval</span> = <span class="ruby-ivar">@__rubybreaker_obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">mname</span>, *<span class="ruby-identifier">args</span>, &<span class="ruby-identifier">blk</span>)
|
387
387
|
|
388
|
-
<span class="ruby-comment"># No need to wrap the object again...if it's wrapped already</span>
|
389
|
-
<span class="ruby-
|
390
|
-
|
391
|
-
<span class="ruby-
|
388
|
+
<span class="ruby-comment"># # No need to wrap the object again...if it's wrapped already</span>
|
389
|
+
<span class="ruby-comment"># unless retval.respond_to?(WRAPPED_INDICATOR)</span>
|
390
|
+
<span class="ruby-comment"># retval = ObjectWrapper.new(retval)</span>
|
391
|
+
<span class="ruby-comment"># end</span>
|
392
392
|
<span class="ruby-keyword">else</span>
|
393
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Object wrapper method_missing for #{mname} started"</span>)
|
393
394
|
<span class="ruby-identifier">retval</span> = <span class="ruby-ivar">@__rubybreaker_obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">mname</span>, *<span class="ruby-identifier">args</span>, &<span class="ruby-identifier">blk</span>)
|
394
395
|
<span class="ruby-keyword">end</span>
|
396
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Object wrapper method_missing for #{mname} ended"</span>)
|
395
397
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">retval</span>
|
396
398
|
<span class="ruby-keyword">end</span></pre>
|
397
399
|
</div><!-- method_missing-source -->
|
@@ -421,7 +423,7 @@ method</p>
|
|
421
423
|
|
422
424
|
|
423
425
|
<div class="method-source-code" id="respond_to-3F-source">
|
424
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
426
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 76</span>
|
425
427
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">mname</span>)
|
426
428
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mname</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-constant">WRAPPED_INDICATOR</span>
|
427
429
|
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@__rubybreaker_obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">mname</span>)
|
@@ -114,8 +114,6 @@
|
|
114
114
|
|
115
115
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
116
116
|
|
117
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
118
|
-
|
119
117
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
120
118
|
|
121
119
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -108,8 +108,6 @@
|
|
108
108
|
|
109
109
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
110
110
|
|
111
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
112
|
-
|
113
111
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
114
112
|
|
115
113
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
@@ -124,8 +124,6 @@
|
|
124
124
|
|
125
125
|
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
126
126
|
|
127
|
-
<li><a href="../../RubyBreaker/RDocSupport.html">RubyBreaker::RDocSupport</a>
|
128
|
-
|
129
127
|
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
130
128
|
|
131
129
|
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|