quarry 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +6 -0
  2. data/COPYING +344 -0
  3. data/MANIFEST +151 -0
  4. data/METADATA +22 -0
  5. data/NEWS +8 -0
  6. data/README +75 -0
  7. data/VERSION +1 -0
  8. data/bin/rubybreak +3 -0
  9. data/bin/xact-ruby +6 -0
  10. data/demo/spec/demo_check.rb +21 -0
  11. data/demo/spec/demo_outline.rb +25 -0
  12. data/demo/test/demo_run.rb +21 -0
  13. data/doc/manual.html2 +1416 -0
  14. data/doc/rdoc/classes/Assertion.html +101 -0
  15. data/doc/rdoc/classes/Assertion/False.html +132 -0
  16. data/doc/rdoc/classes/Assertion/True.html +137 -0
  17. data/doc/rdoc/classes/Kernel.html +86 -0
  18. data/doc/rdoc/classes/Method.html +137 -0
  19. data/doc/rdoc/classes/Module.html +165 -0
  20. data/doc/rdoc/classes/Object.html +154 -0
  21. data/doc/rdoc/classes/Quarry.html +177 -0
  22. data/doc/rdoc/classes/Quarry/Design.html +170 -0
  23. data/doc/rdoc/classes/Quarry/Design/Specification.html +265 -0
  24. data/doc/rdoc/classes/Quarry/Design/Specification/Context.html +174 -0
  25. data/doc/rdoc/classes/Quarry/MethodProbe.html +267 -0
  26. data/doc/rdoc/classes/Quarry/Mock.html +89 -0
  27. data/doc/rdoc/classes/Quarry/Mock/Object.html +276 -0
  28. data/doc/rdoc/created.rid +1 -0
  29. data/doc/rdoc/files/CHANGES.html +100 -0
  30. data/doc/rdoc/files/COPYING.html +457 -0
  31. data/doc/rdoc/files/MANIFEST.html +630 -0
  32. data/doc/rdoc/files/METADATA.html +92 -0
  33. data/doc/rdoc/files/NEWS.html +99 -0
  34. data/doc/rdoc/files/README.html +171 -0
  35. data/doc/rdoc/files/VERSION.html +96 -0
  36. data/doc/rdoc/files/bin/rubybreak.html +96 -0
  37. data/doc/rdoc/files/bin/xact-ruby.html +92 -0
  38. data/doc/rdoc/files/lib/quarry/assert/must_rb.html +96 -0
  39. data/doc/rdoc/files/lib/quarry/assert/should_rb.html +96 -0
  40. data/doc/rdoc/files/lib/quarry/assertion_rb.html +96 -0
  41. data/doc/rdoc/files/lib/quarry/breakout_rb.html +144 -0
  42. data/doc/rdoc/files/lib/quarry/design/spec_rb.html +100 -0
  43. data/doc/rdoc/files/lib/quarry/document_rb.html +92 -0
  44. data/doc/rdoc/files/lib/quarry/loadmonitor_rb.html +92 -0
  45. data/doc/rdoc/files/lib/quarry/methodprobe_rb.html +111 -0
  46. data/doc/rdoc/files/lib/quarry/mock/object_rb.html +123 -0
  47. data/doc/rdoc/files/lib/quarry/mockery_rb.html +115 -0
  48. data/doc/rdoc/fr_class_index.html +60 -0
  49. data/doc/rdoc/fr_file_index.html +65 -0
  50. data/doc/rdoc/fr_method_index.html +77 -0
  51. data/doc/rdoc/index.html +26 -0
  52. data/doc/rdoc/rdoc-style.css +175 -0
  53. data/doc/ri/Assertion/False/assert-i.yaml +10 -0
  54. data/doc/ri/Assertion/False/cdesc-False.yaml +19 -0
  55. data/doc/ri/Assertion/False/message-i.yaml +10 -0
  56. data/doc/ri/Assertion/True/assert-i.yaml +11 -0
  57. data/doc/ri/Assertion/True/cdesc-True.yaml +24 -0
  58. data/doc/ri/Assertion/True/message-c.yaml +11 -0
  59. data/doc/ri/Assertion/True/message-i.yaml +11 -0
  60. data/doc/ri/Assertion/True/method_missing-i.yaml +11 -0
  61. data/doc/ri/Assertion/True/new-c.yaml +11 -0
  62. data/doc/ri/Assertion/cdesc-Assertion.yaml +17 -0
  63. data/doc/ri/Kernel/cdesc-Kernel.yaml +15 -0
  64. data/doc/ri/Method/cdesc-Method.yaml +18 -0
  65. data/doc/ri/Method/migration-i.yaml +12 -0
  66. data/doc/ri/Method/signature-i.yaml +12 -0
  67. data/doc/ri/Module/cdesc-Module.yaml +21 -0
  68. data/doc/ri/Module/doc-i.yaml +16 -0
  69. data/doc/ri/Module/method_added-i.yaml +10 -0
  70. data/doc/ri/Object/assert%21-i.yaml +14 -0
  71. data/doc/ri/Object/assert-i.yaml +14 -0
  72. data/doc/ri/Object/cdesc-Object.yaml +20 -0
  73. data/doc/ri/Quarry/Design/Specification/Context/after-i.yaml +10 -0
  74. data/doc/ri/Quarry/Design/Specification/Context/before-i.yaml +10 -0
  75. data/doc/ri/Quarry/Design/Specification/Context/cdesc-Context.yaml +24 -0
  76. data/doc/ri/Quarry/Design/Specification/Context/method_missing-i.yaml +10 -0
  77. data/doc/ri/Quarry/Design/Specification/Context/specifications-i.yaml +10 -0
  78. data/doc/ri/Quarry/Design/Specification/cdesc-Specification.yaml +44 -0
  79. data/doc/ri/Quarry/Design/Specification/check-i.yaml +12 -0
  80. data/doc/ri/Quarry/Design/Specification/new-c.yaml +12 -0
  81. data/doc/ri/Quarry/Design/Specification/outline-i.yaml +12 -0
  82. data/doc/ri/Quarry/Design/cdesc-Design.yaml +22 -0
  83. data/doc/ri/Quarry/Design/check-c.yaml +12 -0
  84. data/doc/ri/Quarry/Design/outline-c.yaml +10 -0
  85. data/doc/ri/Quarry/Design/specification-c.yaml +10 -0
  86. data/doc/ri/Quarry/Design/specifications-c.yaml +10 -0
  87. data/doc/ri/Quarry/MethodProbe/cdesc-MethodProbe.yaml +46 -0
  88. data/doc/ri/Quarry/MethodProbe/duckcall-c.yaml +10 -0
  89. data/doc/ri/Quarry/MethodProbe/initialize_copy-i.yaml +10 -0
  90. data/doc/ri/Quarry/MethodProbe/method_missing-i.yaml +10 -0
  91. data/doc/ri/Quarry/MethodProbe/new-c.yaml +10 -0
  92. data/doc/ri/Quarry/Mock/Object/cdesc-Object.yaml +52 -0
  93. data/doc/ri/Quarry/Mock/Object/echo-c.yaml +12 -0
  94. data/doc/ri/Quarry/Mock/Object/keys-c.yaml +12 -0
  95. data/doc/ri/Quarry/Mock/Object/mock-c.yaml +12 -0
  96. data/doc/ri/Quarry/Mock/Object/mocks-c.yaml +10 -0
  97. data/doc/ri/Quarry/Mock/Object/spin-c.yaml +12 -0
  98. data/doc/ri/Quarry/Mock/cdesc-Mock.yaml +15 -0
  99. data/doc/ri/Quarry/Mockery-i.yaml +12 -0
  100. data/doc/ri/Quarry/cdesc-Quarry.yaml +17 -0
  101. data/doc/ri/created.rid +1 -0
  102. data/lib/quarry/assert/must.rb +8 -0
  103. data/lib/quarry/assert/should.rb +9 -0
  104. data/lib/quarry/assertion.rb +95 -0
  105. data/lib/quarry/breakout.rb +45 -0
  106. data/lib/quarry/design/spec.rb +197 -0
  107. data/lib/quarry/document.rb +35 -0
  108. data/lib/quarry/loadmonitor.rb +14 -0
  109. data/lib/quarry/methodprobe.rb +216 -0
  110. data/lib/quarry/mock/object.rb +169 -0
  111. data/lib/quarry/mockery.rb +85 -0
  112. metadata +214 -0
@@ -0,0 +1,174 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Class: Quarry::Design::Specification::Context</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Class</span><br />Quarry::Design::Specification::Context</td>
55
+ <td align="right">
56
+ <table cellspacing="0" cellpadding="2">
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../../../../files/lib/quarry/design/spec_rb.html">lib/quarry/design/spec.rb</a>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td>Parent:</td>
65
+ <td>
66
+ <a href="../../../Object.html">
67
+ Object
68
+ </a>
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+ <div id="content">
79
+
80
+ <div class="description"><p>
81
+ A context provides a &quot;clean room&quot; to build a specification.
82
+ </p>
83
+ </div>
84
+
85
+
86
+
87
+ <div class="sectiontitle">Methods</div>
88
+ <ul>
89
+ <li><a href="#M000021">after</a></li>
90
+ <li><a href="#M000020">before</a></li>
91
+ <li><a href="#M000022">method_missing</a></li>
92
+ <li><a href="#M000019">specifications</a></li>
93
+ </ul>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <div class="sectiontitle">Public Instance methods</div>
101
+ <div class="method">
102
+ <div class="title">
103
+ <a name="M000021"></a><b>after</b>(&amp;after)
104
+ </div>
105
+ <div class="sourcecode">
106
+ <p class="source-link">[ <a href="javascript:toggleSource('M000021_source')" id="l_M000021_source">show source</a> ]</p>
107
+ <div id="M000021_source" class="dyn-source">
108
+ <pre>
109
+ <span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 119</span>
110
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">after</span>)
111
+ <span class="ruby-identifier">after</span> <span class="ruby-value">? </span><span class="ruby-ivar">@after</span> = <span class="ruby-identifier">after</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">after</span>
112
+ <span class="ruby-keyword kw">end</span>
113
+ </pre>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ <div class="method">
118
+ <div class="title">
119
+ <a name="M000020"></a><b>before</b>(&amp;before)
120
+ </div>
121
+ <div class="sourcecode">
122
+ <p class="source-link">[ <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show source</a> ]</p>
123
+ <div id="M000020_source" class="dyn-source">
124
+ <pre>
125
+ <span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 115</span>
126
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">before</span>)
127
+ <span class="ruby-identifier">before</span> <span class="ruby-value">? </span><span class="ruby-ivar">@before</span> = <span class="ruby-identifier">before</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">before</span>
128
+ <span class="ruby-keyword kw">end</span>
129
+ </pre>
130
+ </div>
131
+ </div>
132
+ </div>
133
+ <div class="method">
134
+ <div class="title">
135
+ <a name="M000022"></a><b>method_missing</b>(relation, *description, &amp;specification)
136
+ </div>
137
+ <div class="sourcecode">
138
+ <p class="source-link">[ <a href="javascript:toggleSource('M000022_source')" id="l_M000022_source">show source</a> ]</p>
139
+ <div id="M000022_source" class="dyn-source">
140
+ <pre>
141
+ <span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 123</span>
142
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">relation</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">description</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">specification</span>)
143
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">description</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
144
+ <span class="ruby-keyword kw">super</span>
145
+ <span class="ruby-keyword kw">else</span>
146
+ <span class="ruby-identifier">specifications</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Specification</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">relation</span>, <span class="ruby-identifier">description</span>.<span class="ruby-identifier">first</span>, <span class="ruby-keyword kw">self</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">specification</span>)
147
+ <span class="ruby-keyword kw">end</span>
148
+ <span class="ruby-keyword kw">end</span>
149
+ </pre>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ <div class="method">
154
+ <div class="title">
155
+ <a name="M000019"></a><b>specifications</b>()
156
+ </div>
157
+ <div class="sourcecode">
158
+ <p class="source-link">[ <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show source</a> ]</p>
159
+ <div id="M000019_source" class="dyn-source">
160
+ <pre>
161
+ <span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 111</span>
162
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specifications</span>
163
+ <span class="ruby-ivar">@specifications</span> <span class="ruby-operator">||=</span> []
164
+ <span class="ruby-keyword kw">end</span>
165
+ </pre>
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+
171
+ </div>
172
+
173
+ </body>
174
+ </html>
@@ -0,0 +1,267 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Class: Quarry::MethodProbe</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Class</span><br />Quarry::MethodProbe</td>
55
+ <td align="right">
56
+ <table cellspacing="0" cellpadding="2">
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../../files/lib/quarry/methodprobe_rb.html">lib/quarry/methodprobe.rb</a>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td>Parent:</td>
65
+ <td>
66
+ <a href="../Object.html">
67
+ Object
68
+ </a>
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+ <div id="content">
79
+
80
+ <div class="description"><h1><a href="../Method.html">Method</a> Probe</h1>
81
+ <p>
82
+ Method::Probe (aka DuckHunter) is a decoy object which is dropped into
83
+ methods which records the calls made against it &#8212;hence a method
84
+ probe. Of course, it is not perfect &#8212;an inescapable matter it seems
85
+ for any internal probe. There are a couple of issues related to
86
+ conditionals. Since the method test for a certain condition against the
87
+ decoy, how is the decoy to respond? Thus ceratin paths in the code may
88
+ never get exceuted and thus go unmapped. If Ruby had better conditional
89
+ reflection (i.e. if &#8216;if&#8217;, &#8216;case&#8217;,
90
+ &#8216;unless&#8217;, &#8216;when&#8217;, etc. were true methods) then this
91
+ could be fixed by making the Probe reentrant, mapping out variant
92
+ true/false/nil replies. The likely insurmountable problem though is the
93
+ Halting problem. A probe can cause some methods to complete execution.
94
+ It&#8216;s pretty rare, but it can happen and little can be done about it
95
+ (I think).
96
+ </p>
97
+ <p>
98
+ Note, the alternative to this kind of probe is a program that examines,
99
+ rather then executes, the code. This would circumvent the above problems,
100
+ but run into difficulties with dynamic evals. It would also be more
101
+ complicated, but might prove a better means in the future.
102
+ </p>
103
+ <p>
104
+ This script is provided for experimetnal purposes. Please inform the author
105
+ if you find ways to improve it or put it to an interesting use.
106
+ </p>
107
+ <h2>Synopsis</h2>
108
+ <pre>
109
+ require 'methodprobe'
110
+
111
+ def amethod(x)
112
+ x + 1
113
+ end
114
+
115
+ p method(:amethod).signiture
116
+ p method(:amethod).signiture(:class)
117
+ p method(:amethod).signiture(:pretty)
118
+ </pre>
119
+ <p>
120
+ produces
121
+ </p>
122
+ <pre>
123
+ [[&quot;+&quot;]]
124
+ [{&quot;+&quot;=&gt;[[&quot;Fixnum&quot;]]}]
125
+ [[&quot;+( Fixnum )&quot;]]
126
+ </pre>
127
+ </div>
128
+
129
+
130
+
131
+ <div class="sectiontitle">Methods</div>
132
+ <ul>
133
+ <li><a href="#M000028">duckcall</a></li>
134
+ <li><a href="#M000030">initialize_copy</a></li>
135
+ <li><a href="#M000031">method_missing</a></li>
136
+ <li><a href="#M000029">new</a></li>
137
+ </ul>
138
+
139
+
140
+
141
+
142
+
143
+ <div class="sectiontitle">Attributes</div>
144
+ <table border='0' cellpadding='5'>
145
+ <tr valign='top'>
146
+ <td class='attr-rw'>
147
+ [R]
148
+ </td>
149
+ <td class='attr-name'>decoys</td>
150
+ <td class='attr-desc'></td>
151
+ </tr>
152
+ <tr valign='top'>
153
+ <td class='attr-rw'>
154
+ [R]
155
+ </td>
156
+ <td class='attr-name'>ducks</td>
157
+ <td class='attr-desc'></td>
158
+ </tr>
159
+ </table>
160
+
161
+ <div class="sectiontitle">Public Class methods</div>
162
+ <div class="method">
163
+ <div class="title">
164
+ <a name="M000028"></a><b>duckcall</b>() {|| ...}
165
+ </div>
166
+ <div class="sourcecode">
167
+ <p class="source-link">[ <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show source</a> ]</p>
168
+ <div id="M000028_source" class="dyn-source">
169
+ <pre>
170
+ <span class="ruby-comment cmt"># File lib/quarry/methodprobe.rb, line 70</span>
171
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">MethodProbe</span>.<span class="ruby-identifier">duckcall</span>
172
+ <span class="ruby-keyword kw">begin</span>
173
+ <span class="ruby-keyword kw">yield</span>
174
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">TypeError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
175
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>)
176
+ <span class="ruby-keyword kw">retry</span>
177
+ <span class="ruby-keyword kw">end</span>
178
+ <span class="ruby-keyword kw">end</span>
179
+ </pre>
180
+ </div>
181
+ </div>
182
+ </div>
183
+ <div class="method">
184
+ <div class="title">
185
+ <a name="M000029"></a><b>new</b>()
186
+ </div>
187
+ <div class="sourcecode">
188
+ <p class="source-link">[ <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show source</a> ]</p>
189
+ <div id="M000029_source" class="dyn-source">
190
+ <pre>
191
+ <span class="ruby-comment cmt"># File lib/quarry/methodprobe.rb, line 81</span>
192
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
193
+ <span class="ruby-ivar">@ducks</span>, <span class="ruby-ivar">@decoys</span> = {}, {}
194
+ <span class="ruby-keyword kw">end</span>
195
+ </pre>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ <div class="sectiontitle">Public Instance methods</div>
200
+ <div class="method">
201
+ <div class="title">
202
+ <a name="M000030"></a><b>initialize_copy</b>(from)
203
+ </div>
204
+ <div class="sourcecode">
205
+ <p class="source-link">[ <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show source</a> ]</p>
206
+ <div id="M000030_source" class="dyn-source">
207
+ <pre>
208
+ <span class="ruby-comment cmt"># File lib/quarry/methodprobe.rb, line 85</span>
209
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_copy</span>(<span class="ruby-identifier">from</span>)
210
+ <span class="ruby-identifier">initialize</span>
211
+ <span class="ruby-keyword kw">end</span>
212
+ </pre>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ <div class="method">
217
+ <div class="title">
218
+ <a name="M000031"></a><b>method_missing</b>(aSym, *args)
219
+ </div>
220
+ <div class="sourcecode">
221
+ <p class="source-link">[ <a href="javascript:toggleSource('M000031_source')" id="l_M000031_source">show source</a> ]</p>
222
+ <div id="M000031_source" class="dyn-source">
223
+ <pre>
224
+ <span class="ruby-comment cmt"># File lib/quarry/methodprobe.rb, line 89</span>
225
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">aSym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
226
+ <span class="ruby-identifier">aSymStr</span> = <span class="ruby-identifier">aSym</span>.<span class="ruby-identifier">to_s</span>
227
+
228
+ <span class="ruby-comment cmt"># This will happen the first time</span>
229
+ <span class="ruby-ivar">@ducks</span>[<span class="ruby-identifier">aSymStr</span>] <span class="ruby-operator">||=</span> [] <span class="ruby-comment cmt">#unless @ducks[aSymStr]</span>
230
+ <span class="ruby-ivar">@ducks</span>[<span class="ruby-identifier">aSymStr</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{a.class}&quot;</span> }
231
+
232
+ <span class="ruby-identifier">decoy</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
233
+
234
+ <span class="ruby-ivar">@decoys</span>[<span class="ruby-identifier">aSymStr</span>] <span class="ruby-operator">||=</span> [] <span class="ruby-comment cmt">#unless @decoys[aSymStr]</span>
235
+ <span class="ruby-ivar">@decoys</span>[<span class="ruby-identifier">aSymStr</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">decoy</span>
236
+
237
+ <span class="ruby-comment cmt"># build proxy?</span>
238
+ <span class="ruby-comment cmt">#begin</span>
239
+ <span class="ruby-comment cmt"># d = &lt;&lt;-HERE</span>
240
+ <span class="ruby-comment cmt"># def self.#{aSymStr}(*args)</span>
241
+ <span class="ruby-comment cmt"># # This will happen the subsequent times</span>
242
+ <span class="ruby-comment cmt"># @ducks[&quot;#{aSymStr}&quot;] &lt;&lt; args.collect { |a| #{'&quot;#{a.class}&quot;'} }</span>
243
+ <span class="ruby-comment cmt"># @ducks[&quot;#{aSymStr}&quot;].uniq!</span>
244
+ <span class="ruby-comment cmt"># decoy = self.dup</span>
245
+ <span class="ruby-comment cmt"># @decoys[&quot;#{aSymStr}&quot;] = [] unless @decoys[&quot;#{aSymStr}&quot;]</span>
246
+ <span class="ruby-comment cmt"># @decoys[&quot;#{aSymStr}&quot;] &lt;&lt; decoy</span>
247
+ <span class="ruby-comment cmt"># decoy</span>
248
+ <span class="ruby-comment cmt"># end</span>
249
+ <span class="ruby-comment cmt"># HERE</span>
250
+ <span class="ruby-comment cmt"># instance_eval d</span>
251
+ <span class="ruby-comment cmt">#rescue SyntaxError</span>
252
+ <span class="ruby-comment cmt"># puts &quot;This error may be avoidable by returning the failing duck type as the error message.&quot;</span>
253
+ <span class="ruby-comment cmt"># raise</span>
254
+ <span class="ruby-comment cmt">#end</span>
255
+
256
+ <span class="ruby-identifier">decoy</span>
257
+ <span class="ruby-keyword kw">end</span>
258
+ </pre>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ </div>
263
+
264
+ </div>
265
+
266
+ </body>
267
+ </html>
@@ -0,0 +1,89 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title>Module: Quarry::Mock</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
+ <td class="file-title"><span class="file-title-prefix">Module</span><br />Quarry::Mock</td>
55
+ <td align="right">
56
+ <table cellspacing="0" cellpadding="2">
57
+ <tr valign="top">
58
+ <td>In:</td>
59
+ <td>
60
+ <a href="../../files/lib/quarry/mock/object_rb.html">lib/quarry/mock/object.rb</a>
61
+ </td>
62
+ </tr>
63
+ </table>
64
+ </td>
65
+ </tr>
66
+ </table>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+ <div id="content">
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ <div class="sectiontitle">Classes and Modules</div>
79
+ Class <a href="Mock/Object.html" class="link">Quarry::Mock::Object</a><br />
80
+
81
+
82
+
83
+
84
+ </div>
85
+
86
+ </div>
87
+
88
+ </body>
89
+ </html>