rubybreaker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +6 -46
- data/README.md +30 -19
- data/TODO +22 -20
- data/VERSION +1 -1
- data/bin/rubybreaker +11 -2
- data/lib/rubybreaker.rb +31 -11
- data/lib/rubybreaker/debug.rb +5 -49
- data/lib/rubybreaker/{context.rb → debug/context.rb} +0 -0
- data/lib/rubybreaker/debug/debug.rb +61 -0
- data/lib/rubybreaker/{error.rb → debug/error.rb} +1 -1
- data/lib/rubybreaker/runtime.rb +3 -2
- data/lib/rubybreaker/runtime/inspector.rb +20 -13
- data/lib/rubybreaker/runtime/monitor.rb +21 -13
- data/lib/rubybreaker/runtime/object_wrapper.rb +3 -1
- data/lib/rubybreaker/runtime/type_system.rb +3 -2
- data/lib/rubybreaker/test/testcase.rb +0 -1
- data/lib/rubybreaker/type/type.rb +1 -1
- data/lib/rubybreaker/type/type_grammar.treetop +1 -1
- data/lib/rubybreaker/type/type_unparser.rb +1 -1
- data/lib/rubybreaker/util.rb +3 -11
- data/test/integrated/tc_both_broken_breakable.rb +27 -0
- data/test/ts_integrated.rb +1 -0
- data/webpage/index.html +30 -19
- data/webpage/rdoc/RubyBreaker.html +127 -10
- data/webpage/rdoc/RubyBreaker/Breakable.html +1 -5
- data/webpage/rdoc/RubyBreaker/Broken.html +2 -6
- data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +3 -6
- data/webpage/rdoc/RubyBreaker/Context.html +6 -10
- data/webpage/rdoc/RubyBreaker/Errors.html +2 -6
- data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +3 -7
- data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +3 -7
- data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +2 -6
- data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +2 -6
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +3 -7
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +3 -7
- data/webpage/rdoc/RubyBreaker/Main.html +33 -20
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +4 -8
- data/webpage/rdoc/RubyBreaker/Position.html +7 -11
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +25 -18
- data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +4 -8
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +20 -43
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +7 -11
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +6 -10
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +7 -11
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/TypePlaceholder.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +1 -5
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +8 -12
- data/webpage/rdoc/RubyBreaker/TestCase.html +1 -6
- data/webpage/rdoc/RubyBreaker/TypeComparer.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +1 -5
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +1 -5
- data/webpage/rdoc/RubyBreaker/Typing.html +1 -5
- data/webpage/rdoc/RubyBreaker/{Utilities.html → Util.html} +8 -9
- data/webpage/rdoc/created.rid +15 -14
- data/webpage/rdoc/index.html +1 -5
- data/webpage/rdoc/js/search_index.js +1 -1
- data/webpage/rdoc/table_of_contents.html +22 -36
- metadata +9 -7
- data/webpage/rdoc/RubyBreaker/Debug.html +0 -411
- data/webpage/rdoc/RubyBreaker/Kernel.html +0 -259
@@ -94,8 +94,6 @@
|
|
94
94
|
|
95
95
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
96
96
|
|
97
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
98
|
-
|
99
97
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
100
98
|
|
101
99
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -110,8 +108,6 @@
|
|
110
108
|
|
111
109
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
112
110
|
|
113
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
114
|
-
|
115
111
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
116
112
|
|
117
113
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -180,7 +176,7 @@
|
|
180
176
|
|
181
177
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
182
178
|
|
183
|
-
<li><a href="../../RubyBreaker/
|
179
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
184
180
|
|
185
181
|
</ul>
|
186
182
|
</nav>
|
@@ -98,8 +98,6 @@
|
|
98
98
|
|
99
99
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
100
100
|
|
101
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
102
|
-
|
103
101
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
104
102
|
|
105
103
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -114,8 +112,6 @@
|
|
114
112
|
|
115
113
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
116
114
|
|
117
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
118
|
-
|
119
115
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
120
116
|
|
121
117
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -184,7 +180,7 @@
|
|
184
180
|
|
185
181
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
186
182
|
|
187
|
-
<li><a href="../../RubyBreaker/
|
183
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
188
184
|
|
189
185
|
</ul>
|
190
186
|
</nav>
|
@@ -257,7 +253,7 @@ actual work of gathering type information.</p>
|
|
257
253
|
|
258
254
|
|
259
255
|
<div class="method-source-code" id="new-source">
|
260
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
256
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 30</span>
|
261
257
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">pluggable</span>)
|
262
258
|
<span class="ruby-comment"># @mod = mod</span>
|
263
259
|
<span class="ruby-ivar">@pluggable</span> = <span class="ruby-identifier">pluggable</span>
|
@@ -294,7 +290,7 @@ actual work of gathering type information.</p>
|
|
294
290
|
|
295
291
|
|
296
292
|
<div class="method-source-code" id="monitor_after_method-source">
|
297
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
293
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 42</span>
|
298
294
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">monitor_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
299
295
|
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
300
296
|
<span class="ruby-keyword">end</span></pre>
|
@@ -325,7 +321,7 @@ gather type information in the callee.</p>
|
|
325
321
|
|
326
322
|
|
327
323
|
<div class="method-source-code" id="monitor_before_method-source">
|
328
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
324
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 37</span>
|
329
325
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">monitor_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
330
326
|
<span class="ruby-ivar">@pluggable</span>.<span class="ruby-identifier">before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
331
327
|
<span class="ruby-keyword">end</span></pre>
|
@@ -82,8 +82,6 @@
|
|
82
82
|
|
83
83
|
<li><a href="#method-c-rename_meth">::rename_meth</a>
|
84
84
|
|
85
|
-
<li><a href="#method-c-report">::report</a>
|
86
|
-
|
87
85
|
</ul>
|
88
86
|
</nav>
|
89
87
|
|
@@ -106,8 +104,6 @@
|
|
106
104
|
|
107
105
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
108
106
|
|
109
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
110
|
-
|
111
107
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
112
108
|
|
113
109
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -122,8 +118,6 @@
|
|
122
118
|
|
123
119
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
124
120
|
|
125
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
126
|
-
|
127
121
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
128
122
|
|
129
123
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -192,7 +186,7 @@
|
|
192
186
|
|
193
187
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
194
188
|
|
195
|
-
<li><a href="../../RubyBreaker/
|
189
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
196
190
|
|
197
191
|
</ul>
|
198
192
|
</nav>
|
@@ -243,17 +237,29 @@
|
|
243
237
|
|
244
238
|
|
245
239
|
<div class="method-source-code" id="install_module_monitor-source">
|
246
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
240
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 211</span>
|
247
241
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">install_module_monitor</span>(<span class="ruby-identifier">mod</span>)
|
248
|
-
|
242
|
+
|
243
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Installing module monitor for #{mod}"</span>)
|
244
|
+
|
249
245
|
<span class="ruby-constant">Breakable</span><span class="ruby-operator">::</span><span class="ruby-constant">MONITOR_MAP</span>[<span class="ruby-identifier">mod</span>] = <span class="ruby-constant">Monitor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-constant">DEFAULT_TYPE_SYSTEM</span>)
|
250
246
|
<span class="ruby-constant">Breakable</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPE_PLACEHOLDER_MAP</span>[<span class="ruby-identifier">mod</span>] = <span class="ruby-constant">TypePlaceholder</span>.<span class="ruby-identifier">new</span>
|
247
|
+
|
251
248
|
<span class="ruby-identifier">meth_type_map</span> = []
|
252
249
|
<span class="ruby-identifier">meths</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_methods</span>(<span class="ruby-keyword">false</span>)
|
250
|
+
|
251
|
+
<span class="ruby-comment"># RubyBreaker now supports the hybrid of Breakable and Broken. Here,</span>
|
252
|
+
<span class="ruby-comment"># see if any methods are already broken.</span>
|
253
|
+
<span class="ruby-identifier">broken_meth_type_map</span> = <span class="ruby-constant">Inspector</span>.<span class="ruby-identifier">inspect_all</span>(<span class="ruby-identifier">mod</span>)
|
254
|
+
<span class="ruby-identifier">broken_meths</span> = <span class="ruby-identifier">broken_meth_type_map</span>.<span class="ruby-identifier">keys</span>
|
255
|
+
|
253
256
|
<span class="ruby-identifier">meths</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
|
254
|
-
<span class="ruby-
|
257
|
+
<span class="ruby-comment"># As long as the method is not "Broken" yet, it is considered</span>
|
258
|
+
<span class="ruby-comment"># Breakable (if the module is declared to be Breakable).</span>
|
259
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">broken_meths</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">m</span>)
|
260
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">rename_meth</span>(<span class="ruby-identifier">mod</span>,<span class="ruby-identifier">m</span>)
|
261
|
+
<span class="ruby-keyword">end</span>
|
255
262
|
<span class="ruby-keyword">end</span>
|
256
|
-
<span class="ruby-constant">Debug</span>.<span class="ruby-identifier">feed_line</span>()
|
257
263
|
<span class="ruby-keyword">end</span></pre>
|
258
264
|
</div><!-- install_module_monitor-source -->
|
259
265
|
|
@@ -281,7 +287,7 @@
|
|
281
287
|
|
282
288
|
|
283
289
|
<div class="method-source-code" id="is_module-3F-source">
|
284
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
290
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 190</span>
|
285
291
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">is_module?</span>(<span class="ruby-identifier">recv</span>)
|
286
292
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:class</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Module</span>)
|
287
293
|
<span class="ruby-keyword">end</span></pre>
|
@@ -312,11 +318,11 @@ monitor for the class</p>
|
|
312
318
|
|
313
319
|
|
314
320
|
<div class="method-source-code" id="rename_meth-source">
|
315
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
321
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 196</span>
|
316
322
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">rename_meth</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">meth_name</span>)
|
317
323
|
<span class="ruby-identifier">alt_meth_name</span> = <span class="ruby-constant">MonitorUtils</span>.<span class="ruby-identifier">get_alt_meth_name</span>(<span class="ruby-identifier">meth_name</span>)
|
318
324
|
<span class="ruby-identifier">recv</span>.<span class="ruby-identifier">module_eval</span>(<span class="ruby-node">"alias :\"#{alt_meth_name}\" :\"#{meth_name}\""</span>)
|
319
|
-
<span class="ruby-constant">
|
325
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-node">"Adding alternate method for #{meth_name}"</span>)
|
320
326
|
<span class="ruby-identifier">recv</span>.<span class="ruby-identifier">module_eval</span> <span class="ruby-string">" def #{meth_name}(*args, &blk)
|
321
327
|
RubyBreaker::Runtime::MonitorUtils.route(self,
|
322
328
|
"#{meth_name}",
|
@@ -335,35 +341,6 @@ monitor for the class</p>
|
|
335
341
|
</div><!-- rename_meth-method -->
|
336
342
|
|
337
343
|
|
338
|
-
<div id="method-c-report" class="method-detail ">
|
339
|
-
|
340
|
-
<div class="method-heading">
|
341
|
-
<span class="method-name">report</span><span
|
342
|
-
class="method-args">(mod)</span>
|
343
|
-
<span class="method-click-advice">click to toggle source</span>
|
344
|
-
</div>
|
345
|
-
|
346
|
-
|
347
|
-
<div class="method-description">
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
<div class="method-source-code" id="report-source">
|
354
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 224</span>
|
355
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">report</span>(<span class="ruby-identifier">mod</span>)
|
356
|
-
<span class="ruby-keyword">end</span></pre>
|
357
|
-
</div><!-- report-source -->
|
358
|
-
|
359
|
-
</div>
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
</div><!-- report-method -->
|
365
|
-
|
366
|
-
|
367
344
|
</section><!-- public-class-method-details -->
|
368
345
|
|
369
346
|
</section><!-- 5Buntitled-5D -->
|
@@ -100,8 +100,6 @@
|
|
100
100
|
|
101
101
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
102
102
|
|
103
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
104
|
-
|
105
103
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
106
104
|
|
107
105
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -116,8 +114,6 @@
|
|
116
114
|
|
117
115
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
118
116
|
|
119
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
120
|
-
|
121
117
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
122
118
|
|
123
119
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -186,7 +182,7 @@
|
|
186
182
|
|
187
183
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
188
184
|
|
189
|
-
<li><a href="../../RubyBreaker/
|
185
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
190
186
|
|
191
187
|
</ul>
|
192
188
|
</nav>
|
@@ -259,7 +255,7 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
259
255
|
|
260
256
|
|
261
257
|
<div class="method-source-code" id="new-source">
|
262
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
258
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 55</span>
|
263
259
|
<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>
|
264
260
|
</div><!-- new-source -->
|
265
261
|
|
@@ -293,7 +289,7 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
293
289
|
|
294
290
|
|
295
291
|
<div class="method-source-code" id="set_to-source">
|
296
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
292
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 67</span>
|
297
293
|
<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>
|
298
294
|
</div><!-- set_to-source -->
|
299
295
|
|
@@ -321,9 +317,9 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
321
317
|
|
322
318
|
|
323
319
|
<div class="method-source-code" id="turn_off-source">
|
324
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
320
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 62</span>
|
325
321
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">turn_off</span>();
|
326
|
-
<span class="ruby-constant">
|
322
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"Switch turned off"</span>)
|
327
323
|
<span class="ruby-ivar">@switch</span> = <span class="ruby-keyword">false</span>;
|
328
324
|
<span class="ruby-keyword">end</span></pre>
|
329
325
|
</div><!-- turn_off-source -->
|
@@ -352,9 +348,9 @@ otherwise, it WILL fall into an infinite loop.</p>
|
|
352
348
|
|
353
349
|
|
354
350
|
<div class="method-source-code" id="turn_on-source">
|
355
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
351
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 57</span>
|
356
352
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">turn_on</span>();
|
357
|
-
<span class="ruby-constant">
|
353
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"Switch turned on"</span>)
|
358
354
|
<span class="ruby-ivar">@switch</span> = <span class="ruby-keyword">true</span>;
|
359
355
|
<span class="ruby-keyword">end</span></pre>
|
360
356
|
</div><!-- turn_on-source -->
|
@@ -92,8 +92,6 @@
|
|
92
92
|
|
93
93
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
94
94
|
|
95
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
96
|
-
|
97
95
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
98
96
|
|
99
97
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -108,8 +106,6 @@
|
|
108
106
|
|
109
107
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
110
108
|
|
111
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
112
|
-
|
113
109
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
114
110
|
|
115
111
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -178,7 +174,7 @@
|
|
178
174
|
|
179
175
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
180
176
|
|
181
|
-
<li><a href="../../RubyBreaker/
|
177
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
182
178
|
|
183
179
|
</ul>
|
184
180
|
</nav>
|
@@ -229,7 +225,7 @@
|
|
229
225
|
|
230
226
|
|
231
227
|
<div class="method-source-code" id="get_alt_meth_name-source">
|
232
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
228
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 173</span>
|
233
229
|
<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>)
|
234
230
|
<span class="ruby-keyword">return</span> <span class="ruby-node">"__#{meth_name}"</span>
|
235
231
|
<span class="ruby-keyword">end</span></pre>
|
@@ -259,7 +255,7 @@
|
|
259
255
|
|
260
256
|
|
261
257
|
<div class="method-source-code" id="get_orig_meth_name-source">
|
262
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
258
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 178</span>
|
263
259
|
<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>)
|
264
260
|
<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>]
|
265
261
|
<span class="ruby-keyword">end</span></pre>
|
@@ -304,7 +300,7 @@ call.</p>
|
|
304
300
|
|
305
301
|
|
306
302
|
<div class="method-source-code" id="route-source">
|
307
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line
|
303
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 101</span>
|
308
304
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">route</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>)
|
309
305
|
|
310
306
|
<span class="ruby-comment"># remember the switch mode before turning it off</span>
|
@@ -326,7 +322,7 @@ call.</p>
|
|
326
322
|
<span class="ruby-comment"># this is what the renamed method</span>
|
327
323
|
<span class="ruby-identifier">stub_meth_name</span> = <span class="ruby-identifier">get_alt_meth_name</span>(<span class="ruby-identifier">meth_name</span>)
|
328
324
|
|
329
|
-
<span class="ruby-constant">
|
325
|
+
<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>)
|
330
326
|
|
331
327
|
<span class="ruby-comment"># short-circuit if switch was off--i.e., no monitoring</span>
|
332
328
|
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch</span>
|
@@ -349,7 +345,7 @@ call.</p>
|
|
349
345
|
|
350
346
|
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">monitor_before_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
351
347
|
|
352
|
-
<span class="ruby-constant">
|
348
|
+
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">log</span>(<span class="ruby-string">"monitor_before_method ended"</span>)
|
353
349
|
|
354
350
|
<span class="ruby-comment"># we are going to turn the switch back on</span>
|
355
351
|
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
@@ -102,8 +102,6 @@
|
|
102
102
|
|
103
103
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
104
104
|
|
105
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
106
|
-
|
107
105
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
108
106
|
|
109
107
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -118,8 +116,6 @@
|
|
118
116
|
|
119
117
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
120
118
|
|
121
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
122
|
-
|
123
119
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
124
120
|
|
125
121
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -188,7 +184,7 @@
|
|
188
184
|
|
189
185
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
190
186
|
|
191
|
-
<li><a href="../../RubyBreaker/
|
187
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
192
188
|
|
193
189
|
</ul>
|
194
190
|
</nav>
|
@@ -244,7 +240,7 @@ instance_exec</p>
|
|
244
240
|
|
245
241
|
|
246
242
|
<div class="method-source-code" id="new-source">
|
247
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
243
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 22</span>
|
248
244
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">obj</span>)
|
249
245
|
<span class="ruby-ivar">@__rubybreaker_obj</span> = <span class="ruby-identifier">obj</span>
|
250
246
|
<span class="ruby-identifier">nom_type</span> = <span class="ruby-constant">TypeDefs</span><span class="ruby-operator">::</span><span class="ruby-constant">NominalType</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>)
|
@@ -282,7 +278,7 @@ instance_exec</p>
|
|
282
278
|
|
283
279
|
|
284
280
|
<div class="method-source-code" id="__rubybreaker_obj-source">
|
285
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
281
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 29</span>
|
286
282
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">__rubybreaker_obj</span>()
|
287
283
|
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@__rubybreaker_obj</span>
|
288
284
|
<span class="ruby-keyword">end</span></pre>
|
@@ -312,7 +308,7 @@ instance_exec</p>
|
|
312
308
|
|
313
309
|
|
314
310
|
<div class="method-source-code" id="__rubybreaker_type-source">
|
315
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
311
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 34</span>
|
316
312
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">__rubybreaker_type</span>()
|
317
313
|
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@__rubybreaker_type</span>
|
318
314
|
<span class="ruby-keyword">end</span></pre>
|
@@ -342,9 +338,9 @@ instance_exec</p>
|
|
342
338
|
|
343
339
|
|
344
340
|
<div class="method-source-code" id="method_missing-source">
|
345
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
341
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 70</span>
|
346
342
|
<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>)
|
347
|
-
<span class="ruby-constant">
|
343
|
+
<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>)
|
348
344
|
<span class="ruby-keyword">if</span> <span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">switch</span>
|
349
345
|
<span class="ruby-ivar">@__rubybreaker_type</span>.<span class="ruby-identifier">add_meth</span>(<span class="ruby-identifier">mname</span>)
|
350
346
|
<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>)
|
@@ -381,7 +377,7 @@ method</p>
|
|
381
377
|
|
382
378
|
|
383
379
|
<div class="method-source-code" id="respond_to-3F-source">
|
384
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line
|
380
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/object_wrapper.rb, line 64</span>
|
385
381
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">mname</span>)
|
386
382
|
<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>
|
387
383
|
<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>)
|
@@ -90,8 +90,6 @@
|
|
90
90
|
|
91
91
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
92
92
|
|
93
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
94
|
-
|
95
93
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
96
94
|
|
97
95
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -106,8 +104,6 @@
|
|
106
104
|
|
107
105
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
108
106
|
|
109
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
110
|
-
|
111
107
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
112
108
|
|
113
109
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -176,7 +172,7 @@
|
|
176
172
|
|
177
173
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
178
174
|
|
179
|
-
<li><a href="../../RubyBreaker/
|
175
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
180
176
|
|
181
177
|
</ul>
|
182
178
|
</nav>
|
@@ -94,8 +94,6 @@
|
|
94
94
|
|
95
95
|
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
96
96
|
|
97
|
-
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
98
|
-
|
99
97
|
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
100
98
|
|
101
99
|
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
@@ -110,8 +108,6 @@
|
|
110
108
|
|
111
109
|
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
112
110
|
|
113
|
-
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
114
|
-
|
115
111
|
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
116
112
|
|
117
113
|
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
@@ -180,7 +176,7 @@
|
|
180
176
|
|
181
177
|
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
182
178
|
|
183
|
-
<li><a href="../../RubyBreaker/
|
179
|
+
<li><a href="../../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
184
180
|
|
185
181
|
</ul>
|
186
182
|
</nav>
|