stella 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +84 -24
- data/Rakefile +6 -1
- data/lib/stella.rb +5 -4
- data/lib/stella/adapter/ab.rb +31 -4
- data/lib/stella/adapter/base.rb +15 -1
- data/lib/stella/adapter/httperf.rb +35 -4
- data/lib/stella/adapter/siege.rb +51 -29
- data/lib/stella/cli.rb +45 -22
- data/lib/stella/cli/agents.rb +73 -0
- data/lib/stella/cli/language.rb +2 -0
- data/lib/stella/cli/localtest.rb +5 -0
- data/lib/stella/command/base.rb +1 -1
- data/lib/stella/command/localtest.rb +84 -68
- data/lib/stella/test/{summarybase.rb → base.rb} +3 -7
- data/lib/stella/test/definition.rb +10 -5
- data/lib/stella/test/{runsummary.rb → run/summary.rb} +4 -6
- data/lib/stella/test/{testsummary.rb → summary.rb} +27 -29
- data/lib/utils/escape.rb +302 -0
- data/lib/utils/mathutil.rb +36 -34
- data/support/text/en.yaml +7 -1
- metadata +8 -102
- data/doc/classes/Crypto.html +0 -248
- data/doc/classes/Crypto/Key.html +0 -308
- data/doc/classes/Enumerable.html +0 -309
- data/doc/classes/FileUtil.html +0 -310
- data/doc/classes/HTTPUtil.html +0 -530
- data/doc/classes/MathUtil.html +0 -210
- data/doc/classes/Stella.html +0 -238
- data/doc/classes/Stella/Adapter.html +0 -127
- data/doc/classes/Stella/Adapter/ApacheBench.html +0 -1076
- data/doc/classes/Stella/Adapter/Base.html +0 -432
- data/doc/classes/Stella/Adapter/CommandNotReady.html +0 -146
- data/doc/classes/Stella/Adapter/Httperf.html +0 -949
- data/doc/classes/Stella/Adapter/Siege.html +0 -1011
- data/doc/classes/Stella/CLI.html +0 -914
- data/doc/classes/Stella/CLI/Base.html +0 -186
- data/doc/classes/Stella/CLI/Language.html +0 -149
- data/doc/classes/Stella/CLI/LocalTest.html +0 -268
- data/doc/classes/Stella/Command.html +0 -111
- data/doc/classes/Stella/Command/Base.html +0 -335
- data/doc/classes/Stella/Config.html +0 -292
- data/doc/classes/Stella/InvalidArgument.html +0 -242
- data/doc/classes/Stella/LocalTest.html +0 -450
- data/doc/classes/Stella/Logger.html +0 -548
- data/doc/classes/Stella/Response.html +0 -846
- data/doc/classes/Stella/Storable.html +0 -928
- data/doc/classes/Stella/Test.html +0 -142
- data/doc/classes/Stella/Test/DaySummary.html +0 -249
- data/doc/classes/Stella/Test/Definition.html +0 -294
- data/doc/classes/Stella/Test/Definition/Rampup.html +0 -215
- data/doc/classes/Stella/Test/RunSummary.html +0 -315
- data/doc/classes/Stella/Test/SummaryBase.html +0 -286
- data/doc/classes/Stella/Test/TestSummary.html +0 -200
- data/doc/classes/Stella/Text.html +0 -581
- data/doc/classes/Stella/Text/Resource.html +0 -289
- data/doc/classes/Stella/UnavailableAdapter.html +0 -242
- data/doc/classes/Stella/UnknownValue.html +0 -242
- data/doc/classes/Stella/UnsupportedLanguage.html +0 -115
- data/doc/classes/Stella/Util.html +0 -348
- data/doc/classes/TextGraph.html +0 -460
- data/doc/classes/TimerUtil.html +0 -431
- data/doc/created.rid +0 -1
- data/doc/files/LICENSE_txt.html +0 -129
- data/doc/files/README_txt.html +0 -209
- data/doc/files/lib/stella/adapter/ab_rb.html +0 -101
- data/doc/files/lib/stella/adapter/base_rb.html +0 -101
- data/doc/files/lib/stella/adapter/httperf_rb.html +0 -101
- data/doc/files/lib/stella/adapter/siege_rb.html +0 -101
- data/doc/files/lib/stella/cli/base_rb.html +0 -101
- data/doc/files/lib/stella/cli/language_rb.html +0 -101
- data/doc/files/lib/stella/cli/localtest_rb.html +0 -101
- data/doc/files/lib/stella/cli_rb.html +0 -112
- data/doc/files/lib/stella/command/base_rb.html +0 -101
- data/doc/files/lib/stella/command/localtest_rb.html +0 -101
- data/doc/files/lib/stella/logger_rb.html +0 -101
- data/doc/files/lib/stella/response_rb.html +0 -101
- data/doc/files/lib/stella/storable_rb.html +0 -109
- data/doc/files/lib/stella/support_rb.html +0 -101
- data/doc/files/lib/stella/test/daysummary_rb.html +0 -101
- data/doc/files/lib/stella/test/definition_rb.html +0 -101
- data/doc/files/lib/stella/test/runsummary_rb.html +0 -101
- data/doc/files/lib/stella/test/summarybase_rb.html +0 -101
- data/doc/files/lib/stella/test/testsummary_rb.html +0 -108
- data/doc/files/lib/stella/text/resource_rb.html +0 -108
- data/doc/files/lib/stella/text_rb.html +0 -108
- data/doc/files/lib/stella_rb.html +0 -128
- data/doc/files/lib/utils/crypto-key_rb.html +0 -116
- data/doc/files/lib/utils/fileutil_rb.html +0 -108
- data/doc/files/lib/utils/httputil_rb.html +0 -110
- data/doc/files/lib/utils/mathutil_rb.html +0 -101
- data/doc/files/lib/utils/textgraph_rb.html +0 -138
- data/doc/files/lib/utils/timerutil_rb.html +0 -108
- data/doc/fr_class_index.html +0 -66
- data/doc/fr_file_index.html +0 -62
- data/doc/fr_method_index.html +0 -309
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/lib/stella/test/daysummary.rb +0 -93
- data/spec/base.rb +0 -26
- data/spec/shell_spec.rb +0 -12
data/doc/classes/Crypto/Key.html
DELETED
@@ -1,308 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Crypto::Key</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Crypto::Key</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/utils/crypto-key_rb.html">
|
59
|
-
lib/utils/crypto-key.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="method-list">
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
87
|
-
|
88
|
-
<div class="name-list">
|
89
|
-
<a href="#M000254">decrypt</a>
|
90
|
-
<a href="#M000253">encrypt</a>
|
91
|
-
<a href="#M000252">from_file</a>
|
92
|
-
<a href="#M000251">new</a>
|
93
|
-
<a href="#M000255">private?</a>
|
94
|
-
<a href="#M000256">public?</a>
|
95
|
-
<a href="#M000257">type</a>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
</div>
|
100
|
-
|
101
|
-
|
102
|
-
<!-- if includes -->
|
103
|
-
|
104
|
-
<div id="section">
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<div id="attribute-list">
|
111
|
-
<h3 class="section-bar">Attributes</h3>
|
112
|
-
|
113
|
-
<div class="name-list">
|
114
|
-
<table>
|
115
|
-
<tr class="top-aligned-row context-row">
|
116
|
-
<td class="context-item-name">data</td>
|
117
|
-
<td class="context-item-value"> [R] </td>
|
118
|
-
<td class="context-item-desc"></td>
|
119
|
-
</tr>
|
120
|
-
<tr class="top-aligned-row context-row">
|
121
|
-
<td class="context-item-name">key</td>
|
122
|
-
<td class="context-item-value"> [R] </td>
|
123
|
-
<td class="context-item-desc"></td>
|
124
|
-
</tr>
|
125
|
-
</table>
|
126
|
-
</div>
|
127
|
-
</div>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
<!-- if method_list -->
|
132
|
-
<div id="methods">
|
133
|
-
<h3 class="section-bar">Public Class methods</h3>
|
134
|
-
|
135
|
-
<div id="method-M000252" class="method-detail">
|
136
|
-
<a name="M000252"></a>
|
137
|
-
|
138
|
-
<div class="method-heading">
|
139
|
-
<a href="#M000252" class="method-signature">
|
140
|
-
<span class="method-name">from_file</span><span class="method-args">(filename)</span>
|
141
|
-
</a>
|
142
|
-
</div>
|
143
|
-
|
144
|
-
<div class="method-description">
|
145
|
-
<p><a class="source-toggle" href="#"
|
146
|
-
onclick="toggleCode('M000252-source');return false;">[Source]</a></p>
|
147
|
-
<div class="method-source-code" id="M000252-source">
|
148
|
-
<pre>
|
149
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 64</span>
|
150
|
-
64: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">from_file</span>(<span class="ruby-identifier">filename</span>)
|
151
|
-
65: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>( <span class="ruby-identifier">filename</span> )
|
152
|
-
66: <span class="ruby-keyword kw">end</span>
|
153
|
-
</pre>
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
</div>
|
157
|
-
|
158
|
-
<div id="method-M000251" class="method-detail">
|
159
|
-
<a name="M000251"></a>
|
160
|
-
|
161
|
-
<div class="method-heading">
|
162
|
-
<a href="#M000251" class="method-signature">
|
163
|
-
<span class="method-name">new</span><span class="method-args">(data)</span>
|
164
|
-
</a>
|
165
|
-
</div>
|
166
|
-
|
167
|
-
<div class="method-description">
|
168
|
-
<p><a class="source-toggle" href="#"
|
169
|
-
onclick="toggleCode('M000251-source');return false;">[Source]</a></p>
|
170
|
-
<div class="method-source-code" id="M000251-source">
|
171
|
-
<pre>
|
172
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 57</span>
|
173
|
-
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">data</span>)
|
174
|
-
58: <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">data</span>
|
175
|
-
59: <span class="ruby-ivar">@public</span> = (<span class="ruby-identifier">data</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^-----BEGIN (RSA|DSA) PRIVATE KEY-----$/</span>).<span class="ruby-identifier">nil?</span>
|
176
|
-
60: <span class="ruby-ivar">@key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@data</span>)
|
177
|
-
61: <span class="ruby-keyword kw">end</span>
|
178
|
-
</pre>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
184
|
-
|
185
|
-
<div id="method-M000254" class="method-detail">
|
186
|
-
<a name="M000254"></a>
|
187
|
-
|
188
|
-
<div class="method-heading">
|
189
|
-
<a href="#M000254" class="method-signature">
|
190
|
-
<span class="method-name">decrypt</span><span class="method-args">(text)</span>
|
191
|
-
</a>
|
192
|
-
</div>
|
193
|
-
|
194
|
-
<div class="method-description">
|
195
|
-
<p><a class="source-toggle" href="#"
|
196
|
-
onclick="toggleCode('M000254-source');return false;">[Source]</a></p>
|
197
|
-
<div class="method-source-code" id="M000254-source">
|
198
|
-
<pre>
|
199
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 72</span>
|
200
|
-
72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decrypt</span>(<span class="ruby-identifier">text</span>)
|
201
|
-
73: <span class="ruby-ivar">@key</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{type}_decrypt"</span>, <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">text</span>))
|
202
|
-
74: <span class="ruby-keyword kw">end</span>
|
203
|
-
</pre>
|
204
|
-
</div>
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
|
208
|
-
<div id="method-M000253" class="method-detail">
|
209
|
-
<a name="M000253"></a>
|
210
|
-
|
211
|
-
<div class="method-heading">
|
212
|
-
<a href="#M000253" class="method-signature">
|
213
|
-
<span class="method-name">encrypt</span><span class="method-args">(text)</span>
|
214
|
-
</a>
|
215
|
-
</div>
|
216
|
-
|
217
|
-
<div class="method-description">
|
218
|
-
<p><a class="source-toggle" href="#"
|
219
|
-
onclick="toggleCode('M000253-source');return false;">[Source]</a></p>
|
220
|
-
<div class="method-source-code" id="M000253-source">
|
221
|
-
<pre>
|
222
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 68</span>
|
223
|
-
68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encrypt</span>(<span class="ruby-identifier">text</span>)
|
224
|
-
69: <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-ivar">@key</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{type}_encrypt"</span>, <span class="ruby-identifier">text</span>))
|
225
|
-
70: <span class="ruby-keyword kw">end</span>
|
226
|
-
</pre>
|
227
|
-
</div>
|
228
|
-
</div>
|
229
|
-
</div>
|
230
|
-
|
231
|
-
<div id="method-M000255" class="method-detail">
|
232
|
-
<a name="M000255"></a>
|
233
|
-
|
234
|
-
<div class="method-heading">
|
235
|
-
<a href="#M000255" class="method-signature">
|
236
|
-
<span class="method-name">private?</span><span class="method-args">()</span>
|
237
|
-
</a>
|
238
|
-
</div>
|
239
|
-
|
240
|
-
<div class="method-description">
|
241
|
-
<p><a class="source-toggle" href="#"
|
242
|
-
onclick="toggleCode('M000255-source');return false;">[Source]</a></p>
|
243
|
-
<div class="method-source-code" id="M000255-source">
|
244
|
-
<pre>
|
245
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 76</span>
|
246
|
-
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">private?</span>() <span class="ruby-operator">!</span><span class="ruby-ivar">@public</span>; <span class="ruby-keyword kw">end</span>
|
247
|
-
</pre>
|
248
|
-
</div>
|
249
|
-
</div>
|
250
|
-
</div>
|
251
|
-
|
252
|
-
<div id="method-M000256" class="method-detail">
|
253
|
-
<a name="M000256"></a>
|
254
|
-
|
255
|
-
<div class="method-heading">
|
256
|
-
<a href="#M000256" class="method-signature">
|
257
|
-
<span class="method-name">public?</span><span class="method-args">()</span>
|
258
|
-
</a>
|
259
|
-
</div>
|
260
|
-
|
261
|
-
<div class="method-description">
|
262
|
-
<p><a class="source-toggle" href="#"
|
263
|
-
onclick="toggleCode('M000256-source');return false;">[Source]</a></p>
|
264
|
-
<div class="method-source-code" id="M000256-source">
|
265
|
-
<pre>
|
266
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 78</span>
|
267
|
-
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">public?</span>() <span class="ruby-ivar">@public</span>; <span class="ruby-keyword kw">end</span>
|
268
|
-
</pre>
|
269
|
-
</div>
|
270
|
-
</div>
|
271
|
-
</div>
|
272
|
-
|
273
|
-
<div id="method-M000257" class="method-detail">
|
274
|
-
<a name="M000257"></a>
|
275
|
-
|
276
|
-
<div class="method-heading">
|
277
|
-
<a href="#M000257" class="method-signature">
|
278
|
-
<span class="method-name">type</span><span class="method-args">()</span>
|
279
|
-
</a>
|
280
|
-
</div>
|
281
|
-
|
282
|
-
<div class="method-description">
|
283
|
-
<p><a class="source-toggle" href="#"
|
284
|
-
onclick="toggleCode('M000257-source');return false;">[Source]</a></p>
|
285
|
-
<div class="method-source-code" id="M000257-source">
|
286
|
-
<pre>
|
287
|
-
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 80</span>
|
288
|
-
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span>
|
289
|
-
81: <span class="ruby-ivar">@public</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">:public</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:private</span>
|
290
|
-
82: <span class="ruby-keyword kw">end</span>
|
291
|
-
</pre>
|
292
|
-
</div>
|
293
|
-
</div>
|
294
|
-
</div>
|
295
|
-
|
296
|
-
|
297
|
-
</div>
|
298
|
-
|
299
|
-
|
300
|
-
</div>
|
301
|
-
|
302
|
-
|
303
|
-
<div id="validator-badges">
|
304
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
305
|
-
</div>
|
306
|
-
|
307
|
-
</body>
|
308
|
-
</html>
|
data/doc/classes/Enumerable.html
DELETED
@@ -1,309 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: Enumerable</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Enumerable</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/utils/mathutil_rb.html">
|
59
|
-
lib/utils/mathutil.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../files/lib/utils/textgraph_rb.html">
|
63
|
-
lib/utils/textgraph.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
</td>
|
67
|
-
</tr>
|
68
|
-
|
69
|
-
</table>
|
70
|
-
</div>
|
71
|
-
<!-- banner header -->
|
72
|
-
|
73
|
-
<div id="bodyContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
<div id="contextContent">
|
78
|
-
|
79
|
-
<div id="description">
|
80
|
-
<p>
|
81
|
-
Text::Graph Port of Wade Johnson‘s Text::Graph for perl
|
82
|
-
</p>
|
83
|
-
<pre>
|
84
|
-
http://search.cpan.org/src/GWADEJ/Text-Graph-0.23/Graph.pm
|
85
|
-
</pre>
|
86
|
-
<p>
|
87
|
-
Author: Martin DeMello <martindeme…@gmail.com>
|
88
|
-
</p>
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
|
93
|
-
</div>
|
94
|
-
|
95
|
-
<div id="method-list">
|
96
|
-
<h3 class="section-bar">Methods</h3>
|
97
|
-
|
98
|
-
<div class="name-list">
|
99
|
-
<a href="#M000262">average</a>
|
100
|
-
<a href="#M000266">map_with_index</a>
|
101
|
-
<a href="#M000265">minmax</a>
|
102
|
-
<a href="#M000263">sample_variance</a>
|
103
|
-
<a href="#M000264">standard_deviation</a>
|
104
|
-
<a href="#M000261">sum</a>
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
<!-- if includes -->
|
112
|
-
|
113
|
-
<div id="section">
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
<!-- if method_list -->
|
123
|
-
<div id="methods">
|
124
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
125
|
-
|
126
|
-
<div id="method-M000262" class="method-detail">
|
127
|
-
<a name="M000262"></a>
|
128
|
-
|
129
|
-
<div class="method-heading">
|
130
|
-
<a href="#M000262" class="method-signature">
|
131
|
-
<span class="method-name">average</span><span class="method-args">()</span>
|
132
|
-
</a>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<div class="method-description">
|
136
|
-
<p>
|
137
|
-
Average of all the elements of the <a href="Enumerable.html">Enumerable</a>
|
138
|
-
</p>
|
139
|
-
<p>
|
140
|
-
The <a href="Enumerable.html">Enumerable</a> must respond to length
|
141
|
-
</p>
|
142
|
-
<p><a class="source-toggle" href="#"
|
143
|
-
onclick="toggleCode('M000262-source');return false;">[Source]</a></p>
|
144
|
-
<div class="method-source-code" id="M000262-source">
|
145
|
-
<pre>
|
146
|
-
<span class="ruby-comment cmt"># File lib/utils/mathutil.rb, line 18</span>
|
147
|
-
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">average</span>
|
148
|
-
19: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sum</span> <span class="ruby-operator">/</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_f</span>
|
149
|
-
20: <span class="ruby-keyword kw">end</span>
|
150
|
-
</pre>
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
</div>
|
154
|
-
|
155
|
-
<div id="method-M000266" class="method-detail">
|
156
|
-
<a name="M000266"></a>
|
157
|
-
|
158
|
-
<div class="method-heading">
|
159
|
-
<a href="#M000266" class="method-signature">
|
160
|
-
<span class="method-name">map_with_index</span><span class="method-args">() {|e,i| ...}</span>
|
161
|
-
</a>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div class="method-description">
|
165
|
-
<p><a class="source-toggle" href="#"
|
166
|
-
onclick="toggleCode('M000266-source');return false;">[Source]</a></p>
|
167
|
-
<div class="method-source-code" id="M000266-source">
|
168
|
-
<pre>
|
169
|
-
<span class="ruby-comment cmt"># File lib/utils/textgraph.rb, line 55</span>
|
170
|
-
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map_with_index</span>
|
171
|
-
56: <span class="ruby-identifier">a</span> = []
|
172
|
-
57: <span class="ruby-identifier">each_with_index</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">e</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">e</span>,<span class="ruby-identifier">i</span>)}
|
173
|
-
58: <span class="ruby-identifier">a</span>
|
174
|
-
59: <span class="ruby-keyword kw">end</span>
|
175
|
-
</pre>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<div id="method-M000265" class="method-detail">
|
181
|
-
<a name="M000265"></a>
|
182
|
-
|
183
|
-
<div class="method-heading">
|
184
|
-
<a href="#M000265" class="method-signature">
|
185
|
-
<span class="method-name">minmax</span><span class="method-args">()</span>
|
186
|
-
</a>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<div class="method-description">
|
190
|
-
<p><a class="source-toggle" href="#"
|
191
|
-
onclick="toggleCode('M000265-source');return false;">[Source]</a></p>
|
192
|
-
<div class="method-source-code" id="M000265-source">
|
193
|
-
<pre>
|
194
|
-
<span class="ruby-comment cmt"># File lib/utils/textgraph.rb, line 45</span>
|
195
|
-
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">minmax</span>
|
196
|
-
46: <span class="ruby-identifier">min</span> = <span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span>
|
197
|
-
47: <span class="ruby-identifier">max</span> = <span class="ruby-value">-1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span>
|
198
|
-
48: <span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
199
|
-
49: <span class="ruby-identifier">min</span> = <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min</span>
|
200
|
-
50: <span class="ruby-identifier">max</span> = <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">></span> <span class="ruby-identifier">max</span>
|
201
|
-
51: }
|
202
|
-
52: [<span class="ruby-identifier">min</span>, <span class="ruby-identifier">max</span>]
|
203
|
-
53: <span class="ruby-keyword kw">end</span>
|
204
|
-
</pre>
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
</div>
|
208
|
-
|
209
|
-
<div id="method-M000263" class="method-detail">
|
210
|
-
<a name="M000263"></a>
|
211
|
-
|
212
|
-
<div class="method-heading">
|
213
|
-
<a href="#M000263" class="method-signature">
|
214
|
-
<span class="method-name">sample_variance</span><span class="method-args">()</span>
|
215
|
-
</a>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
<p>
|
220
|
-
Sample variance of all the elements of the <a
|
221
|
-
href="Enumerable.html">Enumerable</a>
|
222
|
-
</p>
|
223
|
-
<p>
|
224
|
-
The <a href="Enumerable.html">Enumerable</a> must respond to length
|
225
|
-
</p>
|
226
|
-
<p><a class="source-toggle" href="#"
|
227
|
-
onclick="toggleCode('M000263-source');return false;">[Source]</a></p>
|
228
|
-
<div class="method-source-code" id="M000263-source">
|
229
|
-
<pre>
|
230
|
-
<span class="ruby-comment cmt"># File lib/utils/mathutil.rb, line 27</span>
|
231
|
-
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sample_variance</span>
|
232
|
-
28: <span class="ruby-identifier">avg</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">average</span>
|
233
|
-
29: <span class="ruby-identifier">sum</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">acc</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">acc</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">avg</span>) <span class="ruby-operator">**</span> <span class="ruby-value">2</span> }
|
234
|
-
30: <span class="ruby-keyword kw">return</span> (<span class="ruby-value">1</span> <span class="ruby-operator">/</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">sum</span>)
|
235
|
-
31: <span class="ruby-keyword kw">end</span>
|
236
|
-
</pre>
|
237
|
-
</div>
|
238
|
-
</div>
|
239
|
-
</div>
|
240
|
-
|
241
|
-
<div id="method-M000264" class="method-detail">
|
242
|
-
<a name="M000264"></a>
|
243
|
-
|
244
|
-
<div class="method-heading">
|
245
|
-
<a href="#M000264" class="method-signature">
|
246
|
-
<span class="method-name">standard_deviation</span><span class="method-args">()</span>
|
247
|
-
</a>
|
248
|
-
</div>
|
249
|
-
|
250
|
-
<div class="method-description">
|
251
|
-
<p>
|
252
|
-
Standard deviation of all the elements of the <a
|
253
|
-
href="Enumerable.html">Enumerable</a>
|
254
|
-
</p>
|
255
|
-
<p>
|
256
|
-
The <a href="Enumerable.html">Enumerable</a> must respond to length
|
257
|
-
</p>
|
258
|
-
<p><a class="source-toggle" href="#"
|
259
|
-
onclick="toggleCode('M000264-source');return false;">[Source]</a></p>
|
260
|
-
<div class="method-source-code" id="M000264-source">
|
261
|
-
<pre>
|
262
|
-
<span class="ruby-comment cmt"># File lib/utils/mathutil.rb, line 38</span>
|
263
|
-
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">standard_deviation</span>
|
264
|
-
39: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sample_variance</span>)
|
265
|
-
40: <span class="ruby-keyword kw">end</span>
|
266
|
-
</pre>
|
267
|
-
</div>
|
268
|
-
</div>
|
269
|
-
</div>
|
270
|
-
|
271
|
-
<div id="method-M000261" class="method-detail">
|
272
|
-
<a name="M000261"></a>
|
273
|
-
|
274
|
-
<div class="method-heading">
|
275
|
-
<a href="#M000261" class="method-signature">
|
276
|
-
<span class="method-name">sum</span><span class="method-args">()</span>
|
277
|
-
</a>
|
278
|
-
</div>
|
279
|
-
|
280
|
-
<div class="method-description">
|
281
|
-
<p>
|
282
|
-
Sum of all the elements of the <a href="Enumerable.html">Enumerable</a>
|
283
|
-
</p>
|
284
|
-
<p><a class="source-toggle" href="#"
|
285
|
-
onclick="toggleCode('M000261-source');return false;">[Source]</a></p>
|
286
|
-
<div class="method-source-code" id="M000261-source">
|
287
|
-
<pre>
|
288
|
-
<span class="ruby-comment cmt"># File lib/utils/mathutil.rb, line 9</span>
|
289
|
-
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum</span>
|
290
|
-
10: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">acc</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">acc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span> }
|
291
|
-
11: <span class="ruby-keyword kw">end</span>
|
292
|
-
</pre>
|
293
|
-
</div>
|
294
|
-
</div>
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
</div>
|
299
|
-
|
300
|
-
|
301
|
-
</div>
|
302
|
-
|
303
|
-
|
304
|
-
<div id="validator-badges">
|
305
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
306
|
-
</div>
|
307
|
-
|
308
|
-
</body>
|
309
|
-
</html>
|