rubybreaker 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS +48 -0
- data/README.md +56 -20
- data/Rakefile +9 -34
- data/TODO +10 -10
- data/VERSION +1 -0
- data/bin/gen_stub_rubylib +35 -36
- data/bin/rubybreaker +1 -4
- data/lib/rubybreaker/debug.rb +8 -4
- data/lib/rubybreaker/rubylib/core.rb +738 -571
- data/lib/rubybreaker/runtime/inspector.rb +16 -7
- data/lib/rubybreaker/runtime/monitor.rb +14 -18
- data/lib/rubybreaker/runtime/object_wrapper.rb +9 -3
- data/lib/rubybreaker/runtime/overrides.rb +51 -8
- data/lib/rubybreaker/runtime/pluggable.rb +1 -3
- data/lib/rubybreaker/runtime/type_placeholder.rb +2 -6
- data/lib/rubybreaker/runtime/type_system.rb +53 -17
- data/lib/rubybreaker/runtime/typesig_parser.rb +1 -0
- data/lib/rubybreaker/runtime/util.rb +18 -0
- data/lib/rubybreaker/runtime.rb +42 -15
- data/lib/rubybreaker/type/type_comparer.rb +10 -10
- data/lib/rubybreaker/type/type_grammar.treetop +30 -21
- data/lib/rubybreaker/type/type_unparser.rb +2 -2
- data/lib/rubybreaker/typing/subtyping.rb +21 -21
- data/lib/rubybreaker/util.rb +11 -1
- data/lib/rubybreaker.rb +75 -54
- data/test/integrated/tc_class_methods.rb +35 -0
- data/test/integrated/tc_inherit_broken.rb +29 -0
- data/test/integrated/tc_method_missing.rb +1 -1
- data/test/runtime/tc_obj_wrapper.rb +104 -4
- data/test/ts_integrated.rb +2 -0
- data/test/type/tc_comparer.rb +96 -96
- data/test/type/tc_parser.rb +18 -0
- data/test/type/tc_unparser.rb +16 -0
- data/test/typing/tc_typing.rb +20 -20
- data/webpage/footer.html +1 -1
- data/webpage/header.html +7 -7
- data/webpage/index.html +65 -28
- data/webpage/rdoc/RubyBreaker/Breakable.html +280 -0
- data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +304 -0
- data/webpage/rdoc/RubyBreaker/Broken.html +308 -0
- data/webpage/rdoc/RubyBreaker/Context.html +421 -0
- data/webpage/rdoc/RubyBreaker/Debug.html +411 -0
- data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +263 -0
- data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +263 -0
- data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +214 -0
- data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +212 -0
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +212 -0
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +264 -0
- data/webpage/rdoc/RubyBreaker/Errors.html +209 -0
- data/webpage/rdoc/RubyBreaker/Kernel.html +259 -0
- data/webpage/rdoc/RubyBreaker/Main.html +560 -0
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +334 -0
- data/webpage/rdoc/RubyBreaker/Position.html +463 -0
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +308 -0
- data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +380 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +324 -0
- data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +354 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +379 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +382 -0
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +400 -0
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +411 -0
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +305 -0
- data/webpage/rdoc/RubyBreaker/Runtime/TypePlaceholder.html +280 -0
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +283 -0
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +630 -0
- data/webpage/rdoc/RubyBreaker/Runtime.html +255 -0
- data/webpage/rdoc/RubyBreaker/TestCase.html +332 -0
- data/webpage/rdoc/RubyBreaker/TypeComparer.html +304 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +260 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +310 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +320 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +323 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +281 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +282 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +260 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +282 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +281 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +281 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +329 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +409 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +282 -0
- data/webpage/rdoc/RubyBreaker/TypeDefs.html +212 -0
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +273 -0
- data/webpage/rdoc/RubyBreaker/Typing.html +305 -0
- data/webpage/rdoc/RubyBreaker/Utilities.html +294 -0
- data/webpage/rdoc/RubyBreaker.html +337 -0
- data/webpage/rdoc/created.rid +26 -0
- data/webpage/rdoc/images/add.png +0 -0
- data/webpage/rdoc/images/brick.png +0 -0
- data/webpage/rdoc/images/brick_link.png +0 -0
- data/webpage/rdoc/images/bug.png +0 -0
- data/webpage/rdoc/images/bullet_black.png +0 -0
- data/webpage/rdoc/images/bullet_toggle_minus.png +0 -0
- data/webpage/rdoc/images/bullet_toggle_plus.png +0 -0
- data/webpage/rdoc/images/date.png +0 -0
- data/webpage/rdoc/images/delete.png +0 -0
- data/webpage/rdoc/images/find.png +0 -0
- data/webpage/rdoc/images/loadingAnimation.gif +0 -0
- data/webpage/rdoc/images/macFFBgHack.png +0 -0
- data/webpage/rdoc/images/package.png +0 -0
- data/webpage/rdoc/images/page_green.png +0 -0
- data/webpage/rdoc/images/page_white_text.png +0 -0
- data/webpage/rdoc/images/page_white_width.png +0 -0
- data/webpage/rdoc/images/plugin.png +0 -0
- data/webpage/rdoc/images/ruby.png +0 -0
- data/webpage/rdoc/images/tag_blue.png +0 -0
- data/webpage/rdoc/images/tag_green.png +0 -0
- data/webpage/rdoc/images/transparent.png +0 -0
- data/webpage/rdoc/images/wrench.png +0 -0
- data/webpage/rdoc/images/wrench_orange.png +0 -0
- data/webpage/rdoc/images/zoom.png +0 -0
- data/webpage/rdoc/index.html +165 -0
- data/webpage/rdoc/js/darkfish.js +153 -0
- data/webpage/rdoc/js/jquery.js +18 -0
- data/webpage/rdoc/js/navigation.js +142 -0
- data/webpage/rdoc/js/search.js +94 -0
- data/webpage/rdoc/js/search_index.js +1 -0
- data/webpage/rdoc/js/searcher.js +228 -0
- data/webpage/rdoc/rdoc.css +543 -0
- data/webpage/rdoc/table_of_contents.html +376 -0
- data/webpage/rubybreaker.css +31 -31
- metadata +93 -6
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>module RubyBreaker::Runtime::MonitorUtils - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
|
10
|
+
|
|
11
|
+
<script type="text/javascript">
|
|
12
|
+
var rdoc_rel_prefix = "../../";
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body id="top" class="module">
|
|
24
|
+
<nav id="metadata">
|
|
25
|
+
<nav id="home-section" class="section">
|
|
26
|
+
<h3 class="section-header">
|
|
27
|
+
<a href="../../index.html">Home</a>
|
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
|
30
|
+
</h3>
|
|
31
|
+
</nav>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
36
|
+
<h3 class="section-header">
|
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
39
|
+
</h3>
|
|
40
|
+
</form>
|
|
41
|
+
|
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
|
43
|
+
</nav>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div id="file-metadata">
|
|
47
|
+
<nav id="file-list-section" class="section">
|
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
|
49
|
+
<ul>
|
|
50
|
+
<li>lib/rubybreaker/runtime/monitor.rb
|
|
51
|
+
</ul>
|
|
52
|
+
</nav>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div id="class-metadata">
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<!-- Method Quickref -->
|
|
62
|
+
<nav id="method-list-section" class="section">
|
|
63
|
+
<h3 class="section-header">Methods</h3>
|
|
64
|
+
|
|
65
|
+
<ul class="link-list">
|
|
66
|
+
|
|
67
|
+
<li><a href="#method-c-get_alt_meth_name">::get_alt_meth_name</a>
|
|
68
|
+
|
|
69
|
+
<li><a href="#method-c-get_orig_meth_name">::get_orig_meth_name</a>
|
|
70
|
+
|
|
71
|
+
<li><a href="#method-c-route">::route</a>
|
|
72
|
+
|
|
73
|
+
</ul>
|
|
74
|
+
</nav>
|
|
75
|
+
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div id="project-metadata">
|
|
79
|
+
|
|
80
|
+
<nav id="classindex-section" class="section project-section">
|
|
81
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
82
|
+
|
|
83
|
+
<ul class="link-list">
|
|
84
|
+
|
|
85
|
+
<li><a href="../../RubyBreaker.html">RubyBreaker</a>
|
|
86
|
+
|
|
87
|
+
<li><a href="../../RubyBreaker/Breakable.html">RubyBreaker::Breakable</a>
|
|
88
|
+
|
|
89
|
+
<li><a href="../../RubyBreaker/Broken.html">RubyBreaker::Broken</a>
|
|
90
|
+
|
|
91
|
+
<li><a href="../../RubyBreaker/Broken/BrokenEigen.html">RubyBreaker::Broken::BrokenEigen</a>
|
|
92
|
+
|
|
93
|
+
<li><a href="../../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
|
94
|
+
|
|
95
|
+
<li><a href="../../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
|
|
96
|
+
|
|
97
|
+
<li><a href="../../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
|
98
|
+
|
|
99
|
+
<li><a href="../../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
|
100
|
+
|
|
101
|
+
<li><a href="../../RubyBreaker/Errors/InvalidSubtypeCheck.html">RubyBreaker::Errors::InvalidSubtypeCheck</a>
|
|
102
|
+
|
|
103
|
+
<li><a href="../../RubyBreaker/Errors/InvalidTypeConstruction.html">RubyBreaker::Errors::InvalidTypeConstruction</a>
|
|
104
|
+
|
|
105
|
+
<li><a href="../../RubyBreaker/Errors/SubtypeFailure.html">RubyBreaker::Errors::SubtypeFailure</a>
|
|
106
|
+
|
|
107
|
+
<li><a href="../../RubyBreaker/Errors/TypeError.html">RubyBreaker::Errors::TypeError</a>
|
|
108
|
+
|
|
109
|
+
<li><a href="../../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
|
110
|
+
|
|
111
|
+
<li><a href="../../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
|
|
112
|
+
|
|
113
|
+
<li><a href="../../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
|
114
|
+
|
|
115
|
+
<li><a href="../../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
|
116
|
+
|
|
117
|
+
<li><a href="../../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
|
118
|
+
|
|
119
|
+
<li><a href="../../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
|
120
|
+
|
|
121
|
+
<li><a href="../../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
|
122
|
+
|
|
123
|
+
<li><a href="../../RubyBreaker/Runtime/Inspector.html">RubyBreaker::Runtime::Inspector</a>
|
|
124
|
+
|
|
125
|
+
<li><a href="../../RubyBreaker/Runtime/MethodInfo.html">RubyBreaker::Runtime::MethodInfo</a>
|
|
126
|
+
|
|
127
|
+
<li><a href="../../RubyBreaker/Runtime/Monitor.html">RubyBreaker::Runtime::Monitor</a>
|
|
128
|
+
|
|
129
|
+
<li><a href="../../RubyBreaker/Runtime/MonitorInstaller.html">RubyBreaker::Runtime::MonitorInstaller</a>
|
|
130
|
+
|
|
131
|
+
<li><a href="../../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
|
132
|
+
|
|
133
|
+
<li><a href="../../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
|
134
|
+
|
|
135
|
+
<li><a href="../../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
|
136
|
+
|
|
137
|
+
<li><a href="../../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
|
138
|
+
|
|
139
|
+
<li><a href="../../RubyBreaker/Runtime/TypePlaceholder.html">RubyBreaker::Runtime::TypePlaceholder</a>
|
|
140
|
+
|
|
141
|
+
<li><a href="../../RubyBreaker/Runtime/TypeSigParser.html">RubyBreaker::Runtime::TypeSigParser</a>
|
|
142
|
+
|
|
143
|
+
<li><a href="../../RubyBreaker/Runtime/TypeSystem.html">RubyBreaker::Runtime::TypeSystem</a>
|
|
144
|
+
|
|
145
|
+
<li><a href="../../RubyBreaker/TestCase.html">RubyBreaker::TestCase</a>
|
|
146
|
+
|
|
147
|
+
<li><a href="../../RubyBreaker/TypeComparer.html">RubyBreaker::TypeComparer</a>
|
|
148
|
+
|
|
149
|
+
<li><a href="../../RubyBreaker/TypeDefs.html">RubyBreaker::TypeDefs</a>
|
|
150
|
+
|
|
151
|
+
<li><a href="../../RubyBreaker/TypeDefs/AnyType.html">RubyBreaker::TypeDefs::AnyType</a>
|
|
152
|
+
|
|
153
|
+
<li><a href="../../RubyBreaker/TypeDefs/BlockType.html">RubyBreaker::TypeDefs::BlockType</a>
|
|
154
|
+
|
|
155
|
+
<li><a href="../../RubyBreaker/TypeDefs/DuckType.html">RubyBreaker::TypeDefs::DuckType</a>
|
|
156
|
+
|
|
157
|
+
<li><a href="../../RubyBreaker/TypeDefs/FusionType.html">RubyBreaker::TypeDefs::FusionType</a>
|
|
158
|
+
|
|
159
|
+
<li><a href="../../RubyBreaker/TypeDefs/MethodListType.html">RubyBreaker::TypeDefs::MethodListType</a>
|
|
160
|
+
|
|
161
|
+
<li><a href="../../RubyBreaker/TypeDefs/MethodType.html">RubyBreaker::TypeDefs::MethodType</a>
|
|
162
|
+
|
|
163
|
+
<li><a href="../../RubyBreaker/TypeDefs/NilType.html">RubyBreaker::TypeDefs::NilType</a>
|
|
164
|
+
|
|
165
|
+
<li><a href="../../RubyBreaker/TypeDefs/NominalType.html">RubyBreaker::TypeDefs::NominalType</a>
|
|
166
|
+
|
|
167
|
+
<li><a href="../../RubyBreaker/TypeDefs/OptionalType.html">RubyBreaker::TypeDefs::OptionalType</a>
|
|
168
|
+
|
|
169
|
+
<li><a href="../../RubyBreaker/TypeDefs/OrType.html">RubyBreaker::TypeDefs::OrType</a>
|
|
170
|
+
|
|
171
|
+
<li><a href="../../RubyBreaker/TypeDefs/SelfType.html">RubyBreaker::TypeDefs::SelfType</a>
|
|
172
|
+
|
|
173
|
+
<li><a href="../../RubyBreaker/TypeDefs/Type.html">RubyBreaker::TypeDefs::Type</a>
|
|
174
|
+
|
|
175
|
+
<li><a href="../../RubyBreaker/TypeDefs/VarLengthType.html">RubyBreaker::TypeDefs::VarLengthType</a>
|
|
176
|
+
|
|
177
|
+
<li><a href="../../RubyBreaker/TypeUnparser.html">RubyBreaker::TypeUnparser</a>
|
|
178
|
+
|
|
179
|
+
<li><a href="../../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
|
180
|
+
|
|
181
|
+
<li><a href="../../RubyBreaker/Utilities.html">RubyBreaker::Utilities</a>
|
|
182
|
+
|
|
183
|
+
</ul>
|
|
184
|
+
</nav>
|
|
185
|
+
|
|
186
|
+
</div>
|
|
187
|
+
</nav>
|
|
188
|
+
|
|
189
|
+
<div id="documentation">
|
|
190
|
+
<h1 class="module">module RubyBreaker::Runtime::MonitorUtils</h1>
|
|
191
|
+
|
|
192
|
+
<div id="description" class="description">
|
|
193
|
+
|
|
194
|
+
<p>This module contains helper methods for monitoring objects and modules.</p>
|
|
195
|
+
|
|
196
|
+
</div><!-- description -->
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
<!-- Methods -->
|
|
211
|
+
|
|
212
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
|
213
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<div id="method-c-get_alt_meth_name" class="method-detail ">
|
|
217
|
+
|
|
218
|
+
<div class="method-heading">
|
|
219
|
+
<span class="method-name">get_alt_meth_name</span><span
|
|
220
|
+
class="method-args">(meth_name)</span>
|
|
221
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<div class="method-description">
|
|
226
|
+
|
|
227
|
+
<p>This method returns the alternative (renamed) method name</p>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<div class="method-source-code" id="get_alt_meth_name-source">
|
|
232
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 174</span>
|
|
233
|
+
<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
|
+
<span class="ruby-keyword">return</span> <span class="ruby-node">"__#{meth_name}"</span>
|
|
235
|
+
<span class="ruby-keyword">end</span></pre>
|
|
236
|
+
</div><!-- get_alt_meth_name-source -->
|
|
237
|
+
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
</div><!-- get_alt_meth_name-method -->
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
<div id="method-c-get_orig_meth_name" class="method-detail ">
|
|
247
|
+
|
|
248
|
+
<div class="method-heading">
|
|
249
|
+
<span class="method-name">get_orig_meth_name</span><span
|
|
250
|
+
class="method-args">(meth_name)</span>
|
|
251
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
<div class="method-description">
|
|
256
|
+
|
|
257
|
+
<p>This method returns the original method name</p>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
<div class="method-source-code" id="get_orig_meth_name-source">
|
|
262
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 179</span>
|
|
263
|
+
<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
|
+
<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
|
+
<span class="ruby-keyword">end</span></pre>
|
|
266
|
+
</div><!-- get_orig_meth_name-source -->
|
|
267
|
+
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
</div><!-- get_orig_meth_name-method -->
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
<div id="method-c-route" class="method-detail ">
|
|
277
|
+
|
|
278
|
+
<div class="method-heading">
|
|
279
|
+
<span class="method-name">route</span><span
|
|
280
|
+
class="method-args">(obj,meth_name,*args,&blk)</span>
|
|
281
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<div class="method-description">
|
|
286
|
+
|
|
287
|
+
<p>This will do the actual routing work for a particular “monitored” method
|
|
288
|
+
call.</p>
|
|
289
|
+
<dl class="rdoc-list note-list"><dt>obj
|
|
290
|
+
<dd>
|
|
291
|
+
<p>is the object receiving the message; is never wrapped object</p>
|
|
292
|
+
</dd><dt>meth_name
|
|
293
|
+
<dd><dl class="rdoc-list note-list"><dt>is the original method name being called args
|
|
294
|
+
<dd>
|
|
295
|
+
<p>is a</p>
|
|
296
|
+
</dd></dl>
|
|
297
|
+
</dd><dt>list of arguments for the original method call blk
|
|
298
|
+
<dd>
|
|
299
|
+
<p>is the block</p>
|
|
300
|
+
</dd></dl>
|
|
301
|
+
|
|
302
|
+
<p>argument for the original method call</p>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
<div class="method-source-code" id="route-source">
|
|
307
|
+
<pre><span class="ruby-comment"># File lib/rubybreaker/runtime/monitor.rb, line 102</span>
|
|
308
|
+
<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
|
+
|
|
310
|
+
<span class="ruby-comment"># remember the switch mode before turning it off</span>
|
|
311
|
+
<span class="ruby-identifier">switch</span> = <span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">switch</span>
|
|
312
|
+
|
|
313
|
+
<span class="ruby-comment"># turn off the monitor so we do not fall into an infinite loop</span>
|
|
314
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_off</span>()
|
|
315
|
+
|
|
316
|
+
<span class="ruby-comment"># use symbol instead of string throughout this code</span>
|
|
317
|
+
<span class="ruby-identifier">meth_name</span> = <span class="ruby-value">:"#{meth_name}"</span>
|
|
318
|
+
|
|
319
|
+
<span class="ruby-comment"># first, get the context right</span>
|
|
320
|
+
<span class="ruby-comment"># notice the argument 2 to the caller!</span>
|
|
321
|
+
<span class="ruby-comment">#</span>
|
|
322
|
+
<span class="ruby-comment"># CONTEXT.push(obj, meth_name, </span>
|
|
323
|
+
<span class="ruby-comment"># Position.convert_caller_to_pos(caller(2)))</span>
|
|
324
|
+
<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>)))
|
|
325
|
+
|
|
326
|
+
<span class="ruby-comment"># this is what the renamed method</span>
|
|
327
|
+
<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
|
+
|
|
329
|
+
<span class="ruby-constant">Debug</span>.<span class="ruby-identifier">msg</span>(<span class="ruby-node">"Route to #{stub_meth_name}"</span>,<span class="ruby-constant">CONTEXT</span>)
|
|
330
|
+
|
|
331
|
+
<span class="ruby-comment"># short-circuit if switch was off--i.e., no monitoring</span>
|
|
332
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch</span>
|
|
333
|
+
<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>)
|
|
334
|
+
<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>
|
|
335
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">retval</span>
|
|
336
|
+
<span class="ruby-keyword">end</span>
|
|
337
|
+
|
|
338
|
+
<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>)
|
|
339
|
+
<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>
|
|
340
|
+
|
|
341
|
+
<span class="ruby-comment"># mm = get_module_monitor(mod) unless is_obj_mod</span>
|
|
342
|
+
<span class="ruby-identifier">mm</span> = <span class="ruby-constant">Breakable</span><span class="ruby-operator">::</span><span class="ruby-constant">MONITOR_MAP</span>[<span class="ruby-identifier">mod</span>]
|
|
343
|
+
|
|
344
|
+
<span class="ruby-comment"># There is something wrong if there isn't a module monitor</span>
|
|
345
|
+
<span class="ruby-comment"># associated with the call.</span>
|
|
346
|
+
<span class="ruby-comment"># raise Exception if mm == nil || !mm.meth_type_map.include?(meth_name)</span>
|
|
347
|
+
|
|
348
|
+
<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>)
|
|
349
|
+
|
|
350
|
+
<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
|
+
|
|
352
|
+
<span class="ruby-constant">Debug</span>.<span class="ruby-identifier">msg</span>(<span class="ruby-string">"monitor_before_method ended"</span>)
|
|
353
|
+
|
|
354
|
+
<span class="ruby-comment"># we are going to turn the switch back on</span>
|
|
355
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
|
356
|
+
|
|
357
|
+
<span class="ruby-comment"># call the original method which was renamed</span>
|
|
358
|
+
<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>,
|
|
359
|
+
&<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">blk</span>)
|
|
360
|
+
|
|
361
|
+
<span class="ruby-comment"># turn it off</span>
|
|
362
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_off</span>()
|
|
363
|
+
|
|
364
|
+
<span class="ruby-identifier">meth_info</span>.<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">retval</span>
|
|
365
|
+
<span class="ruby-identifier">mm</span>.<span class="ruby-identifier">monitor_after_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth_info</span>)
|
|
366
|
+
<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>
|
|
367
|
+
<span class="ruby-comment"># after_method monitoring code</span>
|
|
368
|
+
|
|
369
|
+
<span class="ruby-comment"># things are done in this context. pop it off.</span>
|
|
370
|
+
<span class="ruby-constant">CONTEXT</span>.<span class="ruby-identifier">pop</span>()
|
|
371
|
+
|
|
372
|
+
<span class="ruby-comment"># it is always the case that the switch was off when this particular</span>
|
|
373
|
+
<span class="ruby-comment"># call was made. (Otherwise, it would have quit somewhere above</span>
|
|
374
|
+
<span class="ruby-constant">GLOBAL_MONITOR_SWITCH</span>.<span class="ruby-identifier">turn_on</span>()
|
|
375
|
+
|
|
376
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">retval</span> <span class="ruby-comment"># always return the return value</span>
|
|
377
|
+
<span class="ruby-keyword">end</span></pre>
|
|
378
|
+
</div><!-- route-source -->
|
|
379
|
+
|
|
380
|
+
</div>
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
</div><!-- route-method -->
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
</section><!-- public-class-method-details -->
|
|
389
|
+
|
|
390
|
+
</section><!-- 5Buntitled-5D -->
|
|
391
|
+
|
|
392
|
+
</div><!-- documentation -->
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
<footer id="validator-badges">
|
|
396
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
397
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
|
398
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
399
|
+
</footer>
|
|
400
|
+
|