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.
Files changed (122) hide show
  1. data/NEWS +48 -0
  2. data/README.md +56 -20
  3. data/Rakefile +9 -34
  4. data/TODO +10 -10
  5. data/VERSION +1 -0
  6. data/bin/gen_stub_rubylib +35 -36
  7. data/bin/rubybreaker +1 -4
  8. data/lib/rubybreaker/debug.rb +8 -4
  9. data/lib/rubybreaker/rubylib/core.rb +738 -571
  10. data/lib/rubybreaker/runtime/inspector.rb +16 -7
  11. data/lib/rubybreaker/runtime/monitor.rb +14 -18
  12. data/lib/rubybreaker/runtime/object_wrapper.rb +9 -3
  13. data/lib/rubybreaker/runtime/overrides.rb +51 -8
  14. data/lib/rubybreaker/runtime/pluggable.rb +1 -3
  15. data/lib/rubybreaker/runtime/type_placeholder.rb +2 -6
  16. data/lib/rubybreaker/runtime/type_system.rb +53 -17
  17. data/lib/rubybreaker/runtime/typesig_parser.rb +1 -0
  18. data/lib/rubybreaker/runtime/util.rb +18 -0
  19. data/lib/rubybreaker/runtime.rb +42 -15
  20. data/lib/rubybreaker/type/type_comparer.rb +10 -10
  21. data/lib/rubybreaker/type/type_grammar.treetop +30 -21
  22. data/lib/rubybreaker/type/type_unparser.rb +2 -2
  23. data/lib/rubybreaker/typing/subtyping.rb +21 -21
  24. data/lib/rubybreaker/util.rb +11 -1
  25. data/lib/rubybreaker.rb +75 -54
  26. data/test/integrated/tc_class_methods.rb +35 -0
  27. data/test/integrated/tc_inherit_broken.rb +29 -0
  28. data/test/integrated/tc_method_missing.rb +1 -1
  29. data/test/runtime/tc_obj_wrapper.rb +104 -4
  30. data/test/ts_integrated.rb +2 -0
  31. data/test/type/tc_comparer.rb +96 -96
  32. data/test/type/tc_parser.rb +18 -0
  33. data/test/type/tc_unparser.rb +16 -0
  34. data/test/typing/tc_typing.rb +20 -20
  35. data/webpage/footer.html +1 -1
  36. data/webpage/header.html +7 -7
  37. data/webpage/index.html +65 -28
  38. data/webpage/rdoc/RubyBreaker/Breakable.html +280 -0
  39. data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +304 -0
  40. data/webpage/rdoc/RubyBreaker/Broken.html +308 -0
  41. data/webpage/rdoc/RubyBreaker/Context.html +421 -0
  42. data/webpage/rdoc/RubyBreaker/Debug.html +411 -0
  43. data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +263 -0
  44. data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +263 -0
  45. data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +214 -0
  46. data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +212 -0
  47. data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +212 -0
  48. data/webpage/rdoc/RubyBreaker/Errors/UserError.html +264 -0
  49. data/webpage/rdoc/RubyBreaker/Errors.html +209 -0
  50. data/webpage/rdoc/RubyBreaker/Kernel.html +259 -0
  51. data/webpage/rdoc/RubyBreaker/Main.html +560 -0
  52. data/webpage/rdoc/RubyBreaker/ObjectPosition.html +334 -0
  53. data/webpage/rdoc/RubyBreaker/Position.html +463 -0
  54. data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +308 -0
  55. data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +380 -0
  56. data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +324 -0
  57. data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +354 -0
  58. data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +379 -0
  59. data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +382 -0
  60. data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +400 -0
  61. data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +411 -0
  62. data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +305 -0
  63. data/webpage/rdoc/RubyBreaker/Runtime/TypePlaceholder.html +280 -0
  64. data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +283 -0
  65. data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +630 -0
  66. data/webpage/rdoc/RubyBreaker/Runtime.html +255 -0
  67. data/webpage/rdoc/RubyBreaker/TestCase.html +332 -0
  68. data/webpage/rdoc/RubyBreaker/TypeComparer.html +304 -0
  69. data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +260 -0
  70. data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +310 -0
  71. data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +320 -0
  72. data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +323 -0
  73. data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +281 -0
  74. data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +282 -0
  75. data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +260 -0
  76. data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +282 -0
  77. data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +281 -0
  78. data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +281 -0
  79. data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +329 -0
  80. data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +409 -0
  81. data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +282 -0
  82. data/webpage/rdoc/RubyBreaker/TypeDefs.html +212 -0
  83. data/webpage/rdoc/RubyBreaker/TypeUnparser.html +273 -0
  84. data/webpage/rdoc/RubyBreaker/Typing.html +305 -0
  85. data/webpage/rdoc/RubyBreaker/Utilities.html +294 -0
  86. data/webpage/rdoc/RubyBreaker.html +337 -0
  87. data/webpage/rdoc/created.rid +26 -0
  88. data/webpage/rdoc/images/add.png +0 -0
  89. data/webpage/rdoc/images/brick.png +0 -0
  90. data/webpage/rdoc/images/brick_link.png +0 -0
  91. data/webpage/rdoc/images/bug.png +0 -0
  92. data/webpage/rdoc/images/bullet_black.png +0 -0
  93. data/webpage/rdoc/images/bullet_toggle_minus.png +0 -0
  94. data/webpage/rdoc/images/bullet_toggle_plus.png +0 -0
  95. data/webpage/rdoc/images/date.png +0 -0
  96. data/webpage/rdoc/images/delete.png +0 -0
  97. data/webpage/rdoc/images/find.png +0 -0
  98. data/webpage/rdoc/images/loadingAnimation.gif +0 -0
  99. data/webpage/rdoc/images/macFFBgHack.png +0 -0
  100. data/webpage/rdoc/images/package.png +0 -0
  101. data/webpage/rdoc/images/page_green.png +0 -0
  102. data/webpage/rdoc/images/page_white_text.png +0 -0
  103. data/webpage/rdoc/images/page_white_width.png +0 -0
  104. data/webpage/rdoc/images/plugin.png +0 -0
  105. data/webpage/rdoc/images/ruby.png +0 -0
  106. data/webpage/rdoc/images/tag_blue.png +0 -0
  107. data/webpage/rdoc/images/tag_green.png +0 -0
  108. data/webpage/rdoc/images/transparent.png +0 -0
  109. data/webpage/rdoc/images/wrench.png +0 -0
  110. data/webpage/rdoc/images/wrench_orange.png +0 -0
  111. data/webpage/rdoc/images/zoom.png +0 -0
  112. data/webpage/rdoc/index.html +165 -0
  113. data/webpage/rdoc/js/darkfish.js +153 -0
  114. data/webpage/rdoc/js/jquery.js +18 -0
  115. data/webpage/rdoc/js/navigation.js +142 -0
  116. data/webpage/rdoc/js/search.js +94 -0
  117. data/webpage/rdoc/js/search_index.js +1 -0
  118. data/webpage/rdoc/js/searcher.js +228 -0
  119. data/webpage/rdoc/rdoc.css +543 -0
  120. data/webpage/rdoc/table_of_contents.html +376 -0
  121. data/webpage/rubybreaker.css +31 -31
  122. metadata +93 -6
@@ -0,0 +1,560 @@
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::Main - 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.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+
60
+ <!-- Included Modules -->
61
+ <nav id="includes-section" class="section">
62
+ <h3 class="section-header">Included Modules</h3>
63
+
64
+ <ul class="link-list">
65
+
66
+
67
+ <li><a class="include" href="TypeDefs.html">RubyBreaker::TypeDefs</a>
68
+
69
+
70
+
71
+ <li><a class="include" href="Runtime.html">RubyBreaker::Runtime</a>
72
+
73
+
74
+ </ul>
75
+ </nav>
76
+
77
+ <!-- Method Quickref -->
78
+ <nav id="method-list-section" class="section">
79
+ <h3 class="section-header">Methods</h3>
80
+
81
+ <ul class="link-list">
82
+
83
+ <li><a href="#method-c-input">::input</a>
84
+
85
+ <li><a href="#method-c-output">::output</a>
86
+
87
+ <li><a href="#method-c-pp_methods">::pp_methods</a>
88
+
89
+ <li><a href="#method-c-pp_module">::pp_module</a>
90
+
91
+ <li><a href="#method-c-run">::run</a>
92
+
93
+ <li><a href="#method-c-setup">::setup</a>
94
+
95
+ </ul>
96
+ </nav>
97
+
98
+ </div>
99
+
100
+ <div id="project-metadata">
101
+
102
+ <nav id="classindex-section" class="section project-section">
103
+ <h3 class="section-header">Class and Module Index</h3>
104
+
105
+ <ul class="link-list">
106
+
107
+ <li><a href="../RubyBreaker.html">RubyBreaker</a>
108
+
109
+ <li><a href="../RubyBreaker/Breakable.html">RubyBreaker::Breakable</a>
110
+
111
+ <li><a href="../RubyBreaker/Broken.html">RubyBreaker::Broken</a>
112
+
113
+ <li><a href="../RubyBreaker/Broken/BrokenEigen.html">RubyBreaker::Broken::BrokenEigen</a>
114
+
115
+ <li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
116
+
117
+ <li><a href="../RubyBreaker/Debug.html">RubyBreaker::Debug</a>
118
+
119
+ <li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
120
+
121
+ <li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
122
+
123
+ <li><a href="../RubyBreaker/Errors/InvalidSubtypeCheck.html">RubyBreaker::Errors::InvalidSubtypeCheck</a>
124
+
125
+ <li><a href="../RubyBreaker/Errors/InvalidTypeConstruction.html">RubyBreaker::Errors::InvalidTypeConstruction</a>
126
+
127
+ <li><a href="../RubyBreaker/Errors/SubtypeFailure.html">RubyBreaker::Errors::SubtypeFailure</a>
128
+
129
+ <li><a href="../RubyBreaker/Errors/TypeError.html">RubyBreaker::Errors::TypeError</a>
130
+
131
+ <li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
132
+
133
+ <li><a href="../RubyBreaker/Kernel.html">RubyBreaker::Kernel</a>
134
+
135
+ <li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
136
+
137
+ <li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
138
+
139
+ <li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
140
+
141
+ <li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
142
+
143
+ <li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
144
+
145
+ <li><a href="../RubyBreaker/Runtime/Inspector.html">RubyBreaker::Runtime::Inspector</a>
146
+
147
+ <li><a href="../RubyBreaker/Runtime/MethodInfo.html">RubyBreaker::Runtime::MethodInfo</a>
148
+
149
+ <li><a href="../RubyBreaker/Runtime/Monitor.html">RubyBreaker::Runtime::Monitor</a>
150
+
151
+ <li><a href="../RubyBreaker/Runtime/MonitorInstaller.html">RubyBreaker::Runtime::MonitorInstaller</a>
152
+
153
+ <li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
154
+
155
+ <li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
156
+
157
+ <li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
158
+
159
+ <li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
160
+
161
+ <li><a href="../RubyBreaker/Runtime/TypePlaceholder.html">RubyBreaker::Runtime::TypePlaceholder</a>
162
+
163
+ <li><a href="../RubyBreaker/Runtime/TypeSigParser.html">RubyBreaker::Runtime::TypeSigParser</a>
164
+
165
+ <li><a href="../RubyBreaker/Runtime/TypeSystem.html">RubyBreaker::Runtime::TypeSystem</a>
166
+
167
+ <li><a href="../RubyBreaker/TestCase.html">RubyBreaker::TestCase</a>
168
+
169
+ <li><a href="../RubyBreaker/TypeComparer.html">RubyBreaker::TypeComparer</a>
170
+
171
+ <li><a href="../RubyBreaker/TypeDefs.html">RubyBreaker::TypeDefs</a>
172
+
173
+ <li><a href="../RubyBreaker/TypeDefs/AnyType.html">RubyBreaker::TypeDefs::AnyType</a>
174
+
175
+ <li><a href="../RubyBreaker/TypeDefs/BlockType.html">RubyBreaker::TypeDefs::BlockType</a>
176
+
177
+ <li><a href="../RubyBreaker/TypeDefs/DuckType.html">RubyBreaker::TypeDefs::DuckType</a>
178
+
179
+ <li><a href="../RubyBreaker/TypeDefs/FusionType.html">RubyBreaker::TypeDefs::FusionType</a>
180
+
181
+ <li><a href="../RubyBreaker/TypeDefs/MethodListType.html">RubyBreaker::TypeDefs::MethodListType</a>
182
+
183
+ <li><a href="../RubyBreaker/TypeDefs/MethodType.html">RubyBreaker::TypeDefs::MethodType</a>
184
+
185
+ <li><a href="../RubyBreaker/TypeDefs/NilType.html">RubyBreaker::TypeDefs::NilType</a>
186
+
187
+ <li><a href="../RubyBreaker/TypeDefs/NominalType.html">RubyBreaker::TypeDefs::NominalType</a>
188
+
189
+ <li><a href="../RubyBreaker/TypeDefs/OptionalType.html">RubyBreaker::TypeDefs::OptionalType</a>
190
+
191
+ <li><a href="../RubyBreaker/TypeDefs/OrType.html">RubyBreaker::TypeDefs::OrType</a>
192
+
193
+ <li><a href="../RubyBreaker/TypeDefs/SelfType.html">RubyBreaker::TypeDefs::SelfType</a>
194
+
195
+ <li><a href="../RubyBreaker/TypeDefs/Type.html">RubyBreaker::TypeDefs::Type</a>
196
+
197
+ <li><a href="../RubyBreaker/TypeDefs/VarLengthType.html">RubyBreaker::TypeDefs::VarLengthType</a>
198
+
199
+ <li><a href="../RubyBreaker/TypeUnparser.html">RubyBreaker::TypeUnparser</a>
200
+
201
+ <li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
202
+
203
+ <li><a href="../RubyBreaker/Utilities.html">RubyBreaker::Utilities</a>
204
+
205
+ </ul>
206
+ </nav>
207
+
208
+ </div>
209
+ </nav>
210
+
211
+ <div id="documentation">
212
+ <h1 class="module">module RubyBreaker::Main</h1>
213
+
214
+ <div id="description" class="description">
215
+
216
+ <p>This module has a set of entry points to the program and misc. methods for
217
+ running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
218
+
219
+ </div><!-- description -->
220
+
221
+
222
+
223
+
224
+ <section id="5Buntitled-5D" class="documentation-section">
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+ <!-- Methods -->
234
+
235
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
236
+ <h3 class="section-header">Public Class Methods</h3>
237
+
238
+
239
+ <div id="method-c-input" class="method-detail ">
240
+
241
+ <div class="method-heading">
242
+ <span class="method-name">input</span><span
243
+ class="method-args">()</span>
244
+ <span class="method-click-advice">click to toggle source</span>
245
+ </div>
246
+
247
+
248
+ <div class="method-description">
249
+
250
+ <p>Reads the input file if specified or exists</p>
251
+
252
+
253
+
254
+ <div class="method-source-code" id="input-source">
255
+ <pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 69</span>
256
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">input</span>()
257
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
258
+ <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;load \&quot;#{OPTIONS[:io_file]}\&quot;&quot;</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>
259
+ <span class="ruby-keyword">end</span></pre>
260
+ </div><!-- input-source -->
261
+
262
+ </div>
263
+
264
+
265
+
266
+
267
+ </div><!-- input-method -->
268
+
269
+
270
+ <div id="method-c-output" class="method-detail ">
271
+
272
+ <div class="method-heading">
273
+ <span class="method-name">output</span><span
274
+ class="method-args">()</span>
275
+ <span class="method-click-advice">click to toggle source</span>
276
+ </div>
277
+
278
+
279
+ <div class="method-description">
280
+
281
+ <p>This method will generate the output</p>
282
+
283
+
284
+
285
+ <div class="method-source-code" id="output-source">
286
+ <pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 140</span>
287
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">output</span>()
288
+
289
+ <span class="ruby-identifier">io_exist</span> = <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
290
+
291
+ <span class="ruby-identifier">str</span> = <span class="ruby-string">&quot;&quot;</span>
292
+ <span class="ruby-identifier">pp</span> = <span class="ruby-constant">PrettyPrint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">str</span>)
293
+
294
+ <span class="ruby-comment"># Document each module that was monitored</span>
295
+ <span class="ruby-constant">INSTALLED</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_module</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">mod</span>) }
296
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">flush</span>
297
+
298
+ <span class="ruby-comment"># First, display the result on the stdout if set</span>
299
+ <span class="ruby-identifier">print</span> <span class="ruby-identifier">str</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:stdout</span>]
300
+
301
+ <span class="ruby-comment"># If this was a library mode run, exit now. </span>
302
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:mode</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:lib</span>
303
+
304
+ <span class="ruby-comment"># Append the result to the input file (or create a new file)</span>
305
+ <span class="ruby-identifier">open</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>],<span class="ruby-string">&quot;a&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
306
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">io_exist</span>
307
+ <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;# This file is auto-generated by RubyBreaker&quot;</span>
308
+ <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;require \&quot;rubybreaker\&quot;&quot;</span>
309
+ <span class="ruby-keyword">end</span>
310
+ <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">str</span>
311
+ <span class="ruby-keyword">end</span>
312
+ <span class="ruby-keyword">end</span></pre>
313
+ </div><!-- output-source -->
314
+
315
+ </div>
316
+
317
+
318
+
319
+
320
+ </div><!-- output-method -->
321
+
322
+
323
+ <div id="method-c-pp_methods" class="method-detail ">
324
+
325
+ <div class="method-heading">
326
+ <span class="method-name">pp_methods</span><span
327
+ class="method-args">(pp, meth_type_map)</span>
328
+ <span class="method-click-advice">click to toggle source</span>
329
+ </div>
330
+
331
+
332
+ <div class="method-description">
333
+
334
+ <p>Pretty prints type information for methods</p>
335
+
336
+
337
+
338
+ <div class="method-source-code" id="pp_methods-source">
339
+ <pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 75</span>
340
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_methods</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">meth_type_map</span>)
341
+ <span class="ruby-identifier">meth_type_map</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">meth_name</span>, <span class="ruby-identifier">meth_type</span><span class="ruby-operator">|</span>
342
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">meth_type</span>
343
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">MethodType</span>
344
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>()
345
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;typesig(\&quot;&quot;</span>)
346
+ <span class="ruby-constant">TypeUnparser</span>.<span class="ruby-identifier">unparse_pp</span>(<span class="ruby-identifier">pp</span>,<span class="ruby-identifier">meth_type</span>)
347
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;\&quot;)&quot;</span>)
348
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">MethodListType</span>
349
+ <span class="ruby-identifier">meth_type</span>.<span class="ruby-identifier">types</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">real_meth_type</span><span class="ruby-operator">|</span>
350
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>()
351
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;typesig(\&quot;&quot;</span>)
352
+ <span class="ruby-constant">TypeUnparser</span>.<span class="ruby-identifier">unparse_pp</span>(<span class="ruby-identifier">pp</span>,<span class="ruby-identifier">real_meth_type</span>)
353
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;\&quot;)&quot;</span>)
354
+ }
355
+ <span class="ruby-keyword">else</span>
356
+ <span class="ruby-comment"># Can't happen</span>
357
+ <span class="ruby-keyword">end</span>
358
+ }
359
+ <span class="ruby-keyword">end</span></pre>
360
+ </div><!-- pp_methods-source -->
361
+
362
+ </div>
363
+
364
+
365
+
366
+
367
+ </div><!-- pp_methods-method -->
368
+
369
+
370
+ <div id="method-c-pp_module" class="method-detail ">
371
+
372
+ <div class="method-heading">
373
+ <span class="method-name">pp_module</span><span
374
+ class="method-args">(pp, mod)</span>
375
+ <span class="method-click-advice">click to toggle source</span>
376
+ </div>
377
+
378
+
379
+ <div class="method-description">
380
+
381
+ <p>Pretty prints type information for the module/class</p>
382
+
383
+
384
+
385
+ <div class="method-source-code" id="pp_module-source">
386
+ <pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 97</span>
387
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_module</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">mod</span>)
388
+ <span class="ruby-comment"># Skip it if we already have seen it</span>
389
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">DOCUMENTED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mod</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-node">&quot;#&lt;&quot;</span>
390
+
391
+ <span class="ruby-comment"># Remember that we have documented this module/class</span>
392
+ <span class="ruby-constant">DOCUMENTED</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">mod</span>
393
+
394
+ <span class="ruby-comment"># Get the method type mapping</span>
395
+ <span class="ruby-identifier">meth_type_map</span> = <span class="ruby-constant">Inspector</span>.<span class="ruby-identifier">inspect_all</span>(<span class="ruby-identifier">mod</span>)
396
+
397
+ <span class="ruby-comment"># Check if this module is a class</span>
398
+ <span class="ruby-identifier">keyword</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">Class</span>) <span class="ruby-operator">?</span> <span class="ruby-string">&quot;class&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;module&quot;</span>
399
+
400
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-node">&quot;#{keyword} #{mod.to_s}&quot;</span>, <span class="ruby-value">80</span>)
401
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">nest</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword">do</span>
402
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>(<span class="ruby-string">&quot;&quot;</span>)
403
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;include RubyBreaker::Broken&quot;</span>, <span class="ruby-value">80</span>)
404
+
405
+ <span class="ruby-comment"># See if there is any class method to show</span>
406
+ <span class="ruby-identifier">eigen</span> = <span class="ruby-constant">Runtime</span>.<span class="ruby-identifier">eigen_class</span>(<span class="ruby-identifier">mod</span>)
407
+
408
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">DOCUMENTED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">eigen</span>)
409
+ <span class="ruby-constant">DOCUMENTED</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">eigen</span>
410
+ <span class="ruby-identifier">eigen_meth_type_map</span> = <span class="ruby-constant">Inspector</span>.<span class="ruby-identifier">inspect_all</span>(<span class="ruby-identifier">eigen</span>)
411
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">eigen_meth_type_map</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
412
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>()
413
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;class &lt;&lt; self&quot;</span>, <span class="ruby-value">80</span>)
414
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">nest</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword">do</span>
415
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_methods</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">eigen_meth_type_map</span>)
416
+ <span class="ruby-keyword">end</span>
417
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>()
418
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;end&quot;</span>, <span class="ruby-value">80</span>)
419
+ <span class="ruby-keyword">end</span>
420
+ <span class="ruby-keyword">end</span>
421
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pp_methods</span>(<span class="ruby-identifier">pp</span>, <span class="ruby-identifier">meth_type_map</span>)
422
+
423
+ <span class="ruby-keyword">end</span>
424
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>()
425
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">text</span>(<span class="ruby-string">&quot;end&quot;</span>,<span class="ruby-value">80</span>)
426
+ <span class="ruby-identifier">pp</span>.<span class="ruby-identifier">breakable</span>()
427
+ <span class="ruby-keyword">end</span></pre>
428
+ </div><!-- pp_module-source -->
429
+
430
+ </div>
431
+
432
+
433
+
434
+
435
+ </div><!-- pp_module-method -->
436
+
437
+
438
+ <div id="method-c-run" class="method-detail ">
439
+
440
+ <div class="method-heading">
441
+ <span class="method-name">run</span><span
442
+ class="method-args">()</span>
443
+ <span class="method-click-advice">click to toggle source</span>
444
+ </div>
445
+
446
+
447
+ <div class="method-description">
448
+
449
+ <p>This method will run the input file</p>
450
+
451
+
452
+
453
+ <div class="method-source-code" id="run-source">
454
+ <pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 168</span>
455
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run</span>()
456
+
457
+ <span class="ruby-comment"># First, take care of the program file.</span>
458
+
459
+ <span class="ruby-identifier">argv0</span> = <span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>]
460
+ <span class="ruby-identifier">prog_file</span> = <span class="ruby-identifier">argv0</span>
461
+ <span class="ruby-identifier">prog_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">prog_file</span>)
462
+
463
+ <span class="ruby-comment"># It is ok to omit .rb extension. So try to see if prog_file.rb exists</span>
464
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">prog_file</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">prog_file</span>) <span class="ruby-operator">==</span> <span class="ruby-string">&quot;.rb&quot;</span>
465
+ <span class="ruby-identifier">prog_file</span> = <span class="ruby-node">&quot;#{prog_file}.rb&quot;</span>
466
+ <span class="ruby-keyword">end</span>
467
+
468
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">prog_file</span>)
469
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR: '#{argv0}' is an invalid file.&quot;</span>
470
+ <span class="ruby-identifier">exit</span>(<span class="ruby-value">1</span>)
471
+ <span class="ruby-keyword">end</span>
472
+
473
+ <span class="ruby-comment"># Then, input/output file if specified</span>
474
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>].<span class="ruby-identifier">empty?</span>
475
+ <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] = <span class="ruby-node">&quot;#{File.basename(argv0, &quot;.rb&quot;)}.#{EXTENSION}&quot;</span>
476
+ <span class="ruby-keyword">end</span>
477
+ <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
478
+
479
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:rubylib</span>]
480
+ <span class="ruby-comment"># Load the core library type documentation</span>
481
+ <span class="ruby-identifier">eval</span>(<span class="ruby-string">&quot;require \&quot;rubybreaker/rubylib\&quot;&quot;</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>)
482
+ <span class="ruby-keyword">end</span>
483
+
484
+ <span class="ruby-comment"># Read the input file first (as it might contain type documentation</span>
485
+ <span class="ruby-comment"># already)</span>
486
+ <span class="ruby-constant">Main</span>.<span class="ruby-identifier">input</span>()
487
+
488
+ <span class="ruby-comment"># Finally, require the program file! Let it run! Wheeee!</span>
489
+ <span class="ruby-identifier">eval</span>(<span class="ruby-node">&quot;require '#{prog_file}'&quot;</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>)
490
+
491
+ <span class="ruby-keyword">end</span></pre>
492
+ </div><!-- run-source -->
493
+
494
+ </div>
495
+
496
+
497
+
498
+
499
+ </div><!-- run-method -->
500
+
501
+
502
+ <div id="method-c-setup" class="method-detail ">
503
+
504
+ <div class="method-heading">
505
+ <span class="method-name">setup</span><span
506
+ class="method-args">()</span>
507
+ <span class="method-click-advice">click to toggle source</span>
508
+ </div>
509
+
510
+
511
+ <div class="method-description">
512
+
513
+ <p>This method is the trigger point to install a monitor in each module/class.</p>
514
+
515
+
516
+
517
+ <div class="method-source-code" id="setup-source">
518
+ <pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 48</span>
519
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">setup</span>()
520
+
521
+ <span class="ruby-constant">BREAKABLE</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
522
+ <span class="ruby-comment"># Avoid already installed module or now Broken module. Remember,</span>
523
+ <span class="ruby-comment"># once a module is a declared to be Broken, it wins. Broken modules</span>
524
+ <span class="ruby-comment"># cannot be Breakable!</span>
525
+ <span class="ruby-keyword">unless</span> <span class="ruby-constant">INSTALLED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mod</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">BROKEN</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mod</span>)
526
+ <span class="ruby-constant">MonitorInstaller</span>.<span class="ruby-identifier">install_module_monitor</span>(<span class="ruby-identifier">mod</span>)
527
+ <span class="ruby-constant">INSTALLED</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">mod</span>
528
+ <span class="ruby-keyword">end</span>
529
+
530
+ <span class="ruby-keyword">end</span>
531
+
532
+ <span class="ruby-comment"># At the end, we generate an output of the type information.</span>
533
+ <span class="ruby-identifier">at_exit</span> <span class="ruby-keyword">do</span>
534
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">output</span>
535
+ <span class="ruby-keyword">end</span>
536
+
537
+ <span class="ruby-keyword">end</span></pre>
538
+ </div><!-- setup-source -->
539
+
540
+ </div>
541
+
542
+
543
+
544
+
545
+ </div><!-- setup-method -->
546
+
547
+
548
+ </section><!-- public-class-method-details -->
549
+
550
+ </section><!-- 5Buntitled-5D -->
551
+
552
+ </div><!-- documentation -->
553
+
554
+
555
+ <footer id="validator-badges">
556
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
557
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
558
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
559
+ </footer>
560
+