inochi 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +1 -0
- data/bin/inochi +112 -104
- data/doc/api/classes/Array.html +370 -0
- data/doc/api/classes/File.html +110 -0
- data/doc/api/classes/Inochi.html +1493 -0
- data/doc/api/classes/Inochi/Manual.html +157 -0
- data/doc/api/classes/Inochi/Phrases.html +331 -0
- data/doc/api/classes/Inochi/Version.html +190 -0
- data/doc/api/classes/TempDir.html +164 -0
- data/doc/api/created.rid +1 -0
- data/doc/api/css/main.css +263 -0
- data/doc/api/css/panel.css +383 -0
- data/doc/api/css/reset.css +53 -0
- data/doc/api/files/CREDITS.html +61 -0
- data/doc/api/files/LICENSE.html +76 -0
- data/doc/api/files/lib/inochi/book_rb.html +96 -0
- data/doc/api/files/lib/inochi/init_rb.html +78 -0
- data/doc/api/files/lib/inochi/main_rb.html +52 -0
- data/doc/api/files/lib/inochi/rake_rb.html +52 -0
- data/doc/api/files/lib/inochi/test/bacon_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/context_rb.html +69 -0
- data/doc/api/files/lib/inochi/test/dfect_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/matchy_rb.html +69 -0
- data/doc/api/files/lib/inochi/test/minitest_rb.html +71 -0
- data/doc/api/files/lib/inochi/test/mocha_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/rspec_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/shoulda_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/test_spec_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/test_unit_rb.html +67 -0
- data/doc/api/files/lib/inochi/util/combo_rb.html +59 -0
- data/doc/api/files/lib/inochi/util/tempdir_rb.html +68 -0
- data/doc/api/files/lib/inochi/util_rb.html +59 -0
- data/doc/api/files/lib/inochi_rb.html +78 -0
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/index.html +14 -18
- data/doc/api/js/jquery-1.3.2.min.js +19 -0
- data/doc/api/js/jquery-effect.js +593 -0
- data/doc/api/js/main.js +22 -0
- data/doc/api/js/searchdoc.js +605 -0
- data/doc/api/panel/index.html +63 -0
- data/doc/api/panel/search_index.js +1 -0
- data/doc/api/panel/tree.js +1 -0
- data/doc/history.erb +75 -34
- data/doc/index.erb +10 -5
- data/doc/index.xhtml +806 -1145
- data/doc/intro.erb +33 -27
- data/doc/setup.erb +16 -15
- data/doc/usage.erb +86 -137
- data/lib/inochi.rb +25 -13
- data/lib/inochi/book.rb +13 -6
- data/lib/inochi/init.rb +41 -24
- data/lib/inochi/main.rb +17 -7
- data/lib/inochi/rake.rb +200 -59
- data/lib/inochi/test/bacon.rb +3 -0
- data/lib/inochi/test/context.rb +4 -0
- data/lib/inochi/test/dfect.rb +3 -0
- data/lib/inochi/test/matchy.rb +4 -0
- data/lib/inochi/test/minitest.rb +7 -0
- data/lib/inochi/test/mocha.rb +3 -0
- data/lib/inochi/test/rspec.rb +3 -0
- data/lib/inochi/test/shoulda.rb +3 -0
- data/lib/inochi/test/test_spec.rb +3 -0
- data/lib/inochi/test/test_unit.rb +3 -0
- data/lib/inochi/util.rb +23 -1
- data/lib/inochi/util/combo.rb +191 -0
- data/lib/inochi/util/tempdir.rb +29 -0
- data/rakefile +12 -0
- data/test/inochi.rb +5 -0
- metadata +119 -45
- data/Rakefile +0 -6
- data/doc/api/Inochi.html +0 -2574
- data/doc/api/Inochi/Manual.html +0 -230
- data/doc/api/Inochi/Phrases.html +0 -409
- data/doc/api/Inochi/Version.html +0 -222
- data/doc/api/all-methods.html +0 -180
- data/doc/api/all-namespaces.html +0 -28
- data/doc/api/app.js +0 -18
- data/doc/api/jquery.js +0 -11
- data/doc/api/readme.html +0 -38
- data/doc/api/style.css +0 -68
- data/doc/api/syntax_highlight.css +0 -21
- data/doc/theory.erb +0 -3
data/CREDITS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* Florian Gilcher
|
data/bin/inochi
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
#
|
25
25
|
#
|
26
26
|
# ProjectName: Name of your project, which will be normalized
|
27
|
-
# into the
|
27
|
+
# into the name of a Ruby module that will serve
|
28
28
|
# as a namespace for all code in your project.
|
29
29
|
#
|
30
30
|
# ProgramName: (Optional) Name of the main project executable,
|
@@ -35,6 +35,11 @@
|
|
35
35
|
# Options:
|
36
36
|
#
|
37
37
|
|
38
|
+
#--
|
39
|
+
# Copyright 2009 Suraj N. Kurapati
|
40
|
+
# See the LICENSE file for details.
|
41
|
+
#++
|
42
|
+
|
38
43
|
# command line
|
39
44
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'inochi')
|
40
45
|
|
@@ -99,6 +104,13 @@
|
|
99
104
|
require '#{Inochi::PROGRAM}'
|
100
105
|
}.strip
|
101
106
|
|
107
|
+
create "#{program_name}/CREDITS", %{
|
108
|
+
* Contributor name
|
109
|
+
* [Contributor name with hyperlink](http://the.contributor's.url)
|
110
|
+
* Another contributor
|
111
|
+
* Yet another contributor
|
112
|
+
}
|
113
|
+
|
102
114
|
create "#{program_name}/LICENSE", %{
|
103
115
|
(the ISC license)
|
104
116
|
|
@@ -117,7 +129,7 @@
|
|
117
129
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
118
130
|
}
|
119
131
|
|
120
|
-
create "#{program_name}/
|
132
|
+
create "#{program_name}/rakefile", %{
|
121
133
|
#{inochi_preamble}
|
122
134
|
|
123
135
|
Inochi.rake #{project_symbol.inspect} do |gem|
|
@@ -175,7 +187,7 @@
|
|
175
187
|
:version => '#{project_version}',
|
176
188
|
:release => '#{project_release}',
|
177
189
|
:website => 'http://#{program_name}.rubyforge.org',
|
178
|
-
:tagline => '
|
190
|
+
:tagline => 'put a single line description of your project here',
|
179
191
|
:require => {
|
180
192
|
# TODO: list gems required by your project here.
|
181
193
|
# NOTE: this is completely optional!
|
@@ -189,66 +201,74 @@
|
|
189
201
|
}
|
190
202
|
|
191
203
|
create "#{program_name}/test/#{program_name}.rb", %{
|
192
|
-
|
193
|
-
|
194
|
-
|
204
|
+
unless #{project_symbol}.const_defined? :INOCHI
|
205
|
+
fail "#{project_symbol} must be established by Inochi"
|
206
|
+
end
|
195
207
|
|
196
|
-
|
197
|
-
|
208
|
+
#{project_symbol}::INOCHI.each do |param, value|
|
209
|
+
const = param.to_s.upcase
|
198
210
|
|
199
|
-
|
200
|
-
|
201
|
-
|
211
|
+
unless #{project_symbol}.const_defined? const
|
212
|
+
fail "#{project_symbol}::\#{const} must be established by Inochi"
|
213
|
+
end
|
214
|
+
|
215
|
+
unless #{project_symbol}.const_get(const) == value
|
216
|
+
fail "#{project_symbol}::\#{const} is not what Inochi established"
|
202
217
|
end
|
203
218
|
end
|
219
|
+
|
220
|
+
puts "Inochi establishment tests passed!"
|
204
221
|
}
|
205
222
|
|
206
223
|
create "#{program_name}/doc/index.erb", %{
|
207
|
-
|
224
|
+
% Inochi.book #{project_symbol.inspect}, self
|
208
225
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
226
|
+
%+ "intro.erb"
|
227
|
+
%+ "setup.erb"
|
228
|
+
%+ "theory.erb"
|
229
|
+
%+ "usage.erb"
|
230
|
+
%+ "history.erb"
|
214
231
|
}
|
215
232
|
|
216
233
|
create "#{program_name}/doc/intro.erb", %{
|
217
|
-
|
218
|
-
|
234
|
+
% api_url = './api/index.html'
|
235
|
+
% repo_url = 'http://github.com/__________/' + $program
|
236
|
+
% repo_scm = '[Git](http://git-scm.com)'
|
237
|
+
|
238
|
+
%|chapter "Introduction"
|
239
|
+
%|project
|
219
240
|
> TODO: explain the purpose of your project
|
220
241
|
|
221
|
-
|
222
|
-
<% end %>
|
242
|
+
<%= $project %> is a __________ that __________.
|
223
243
|
|
224
|
-
|
244
|
+
> TODO: explain why your project is important
|
225
245
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
246
|
+
<%= $project %> is exciting because:
|
247
|
+
* It lets you __________.
|
248
|
+
* Its core contains less than __________ lines of code.
|
249
|
+
* It __________.
|
230
250
|
|
231
|
-
|
251
|
+
> TODO: explain why your project is better than its competitors
|
232
252
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
253
|
+
These features distinguish <%= $project %> from the competition:
|
254
|
+
* [competitor 1](http://)
|
255
|
+
* [competitor 2](http://)
|
256
|
+
* [competitor 3](http://)
|
237
257
|
|
238
|
-
|
258
|
+
%|paragraph "Etymology"
|
239
259
|
> TODO: explain the meaning of the name of your project
|
240
|
-
<% end %>
|
241
260
|
|
242
|
-
|
261
|
+
%|section "Logistics"
|
243
262
|
* <%= xref "History", "Release notes" %> --- history of project releases.
|
244
|
-
* [Source code](
|
245
|
-
* [API reference](
|
263
|
+
* [Source code](<%= repo_url %>) --- obtain via <%= repo_scm %> or browse online.
|
264
|
+
* [API reference](<%= api_url %>) --- documentation for source code.
|
265
|
+
* [Project home](<%= $website %>) --- the <%= $project %> project home page.
|
246
266
|
|
247
267
|
To get help or provide feedback, simply
|
248
268
|
<%= xref "License", "contact the author(s)" %>.
|
249
269
|
|
250
|
-
|
251
|
-
|
270
|
+
%|paragraph "Version numbers"
|
271
|
+
<%= $project %> releases are numbered in *major.minor.patch*
|
252
272
|
form according to the [RubyGems rational versioning
|
253
273
|
policy](http://www.rubygems.org/read/chapter/7), which
|
254
274
|
can be summarized thus:
|
@@ -286,42 +306,34 @@
|
|
286
306
|
</tr>
|
287
307
|
</tbody>
|
288
308
|
</table>
|
289
|
-
<% end %>
|
290
|
-
<% end %>
|
291
309
|
|
292
|
-
|
293
|
-
|
294
|
-
<% end %>
|
310
|
+
%|paragraph "License"
|
311
|
+
%< "../LICENSE"
|
295
312
|
|
296
|
-
|
313
|
+
%|section "Credits"
|
297
314
|
> TODO: give attribution to your predecessors and contributors
|
298
315
|
|
299
|
-
|
316
|
+
<%= $project %> is made possible by
|
300
317
|
<%= xref "History", "contributions" %>
|
301
318
|
from users like you:
|
302
319
|
|
303
|
-
|
304
|
-
* __________ (contributor name)
|
305
|
-
* __________ (contributor name)
|
306
|
-
<% end %>
|
307
|
-
<% end %>
|
320
|
+
%< "../CREDITS"
|
308
321
|
}
|
309
322
|
|
310
323
|
create "#{program_name}/doc/setup.erb", %{
|
311
|
-
|
312
|
-
|
313
|
-
Your system needs the following software to run
|
324
|
+
%|chapter "Setup"
|
325
|
+
%|section "Requirements"
|
326
|
+
Your system needs the following software to run <%= $project %>.
|
314
327
|
|
315
328
|
| Software | Description | Notes |
|
316
329
|
| -------- | ----------- | ----- |
|
317
|
-
| [Ruby](http://ruby-lang.org) | Ruby language interpreter | Version #{RUBY_VERSION}
|
318
|
-
| [RubyGems](http://rubygems.org) | Ruby packaging system | Version #{Gem::RubyGemsVersion} is required. |
|
319
|
-
<% end %>
|
330
|
+
| [Ruby](http://ruby-lang.org) | Ruby language interpreter | Version #{RUBY_VERSION} has been tested successfully. |
|
331
|
+
| [RubyGems](http://rubygems.org) | Ruby packaging system | Version #{Gem::RubyGemsVersion} or newer is required. |
|
320
332
|
|
321
|
-
|
322
|
-
You can install
|
333
|
+
%|section "Installation"
|
334
|
+
You can install <%= $project %> by running this command:
|
323
335
|
|
324
|
-
gem install
|
336
|
+
gem install <%= $program %>
|
325
337
|
|
326
338
|
To check whether the installation was sucessful, run this command:
|
327
339
|
|
@@ -333,10 +345,9 @@
|
|
333
345
|
|
334
346
|
If you do not see such output, you may
|
335
347
|
<%= xref "License", "ask the author(s)" %> for help.
|
336
|
-
<% end %>
|
337
348
|
|
338
|
-
|
339
|
-
You will see the following items inside
|
349
|
+
%|section "Manifest"
|
350
|
+
You will see the following items inside <%= $project %>'s installation
|
340
351
|
directory, whose path you can determine by running this command:
|
341
352
|
|
342
353
|
<%= $program %> --version
|
@@ -345,11 +356,11 @@
|
|
345
356
|
|
346
357
|
* <tt>bin/</tt>
|
347
358
|
|
348
|
-
* <tt><%= $program %></tt> --- the main
|
359
|
+
* <tt><%= $program %></tt> --- the main <%= $project %> executable.
|
349
360
|
|
350
361
|
* <tt>lib/</tt>
|
351
362
|
|
352
|
-
* <tt><%= $program %>.rb</tt> --- the main
|
363
|
+
* <tt><%= $program %>.rb</tt> --- the main <%= $project %> library.
|
353
364
|
|
354
365
|
* <tt><%= $program %>/</tt>
|
355
366
|
|
@@ -364,99 +375,96 @@
|
|
364
375
|
* <tt>lang/</tt> --- translations of language phrases.
|
365
376
|
|
366
377
|
* <tt>LICENSE</tt> --- copyright notice and legal conditions.
|
367
|
-
|
368
|
-
|
378
|
+
|
379
|
+
* <tt>CREDITS</tt> --- attribution of project contributors.
|
369
380
|
}
|
370
381
|
|
371
382
|
create "#{program_name}/doc/theory.erb", %{
|
372
|
-
|
383
|
+
%|chapter "Theory of operation"
|
373
384
|
> TODO: explain how your project does what it does
|
374
|
-
<% end %>
|
375
385
|
}
|
376
386
|
|
377
387
|
create "#{program_name}/doc/usage.erb", %{
|
378
|
-
|
379
|
-
|
388
|
+
%|chapter "Usage"
|
389
|
+
%|section "Command-line interface"
|
380
390
|
When you run this command:
|
381
391
|
|
382
392
|
<%= $program %> --help
|
383
393
|
|
384
394
|
You will see this output:
|
385
395
|
|
386
|
-
<pre><%= verbatim `ruby bin/\#{$
|
396
|
+
<pre><%= verbatim `ruby bin/\#{$program} --help` %></pre>
|
387
397
|
|
388
398
|
> TODO: explain the command-line arguments
|
389
|
-
<% end %>
|
390
399
|
|
391
|
-
|
400
|
+
%|section "Ruby library interface"
|
392
401
|
> TODO: explain how to use your project's Ruby library
|
393
402
|
> from inside another Ruby program or library
|
394
|
-
<% end %>
|
395
403
|
|
396
|
-
|
397
|
-
This tutorial shows how
|
404
|
+
%|section "Tutorial"
|
405
|
+
This tutorial shows how <%= $project %> is used to __________.
|
398
406
|
|
399
407
|
> TODO: give examples for doing common tasks
|
400
|
-
<% end %>
|
401
408
|
|
402
409
|
> TODO: explain how to do more (advanced) things
|
403
|
-
<% end %>
|
404
410
|
}
|
405
411
|
|
406
412
|
create "#{program_name}/doc/history.erb", %{
|
407
|
-
|
413
|
+
%|chapter "History"
|
408
414
|
> TODO: put a brief history about your project here
|
409
415
|
|
410
|
-
|
416
|
+
%|history
|
411
417
|
> TODO: put release notes for your project
|
412
418
|
> here -- newest first, oldest last.
|
413
419
|
|
414
|
-
|
420
|
+
%|section "Version #{project_version} (#{project_release})"
|
415
421
|
> TODO: write a short summary of the changes in this release
|
416
422
|
|
417
423
|
This release changes __________, adds __________, and fixes __________.
|
418
424
|
|
419
|
-
|
425
|
+
%|paragraph "Thank you"
|
426
|
+
> TODO: list everyone who contributed to this release
|
427
|
+
|
428
|
+
* __________ contributed __________
|
429
|
+
|
430
|
+
* __________ suggested __________
|
431
|
+
|
432
|
+
* __________ helped to __________
|
433
|
+
|
434
|
+
%|paragraph "Incompatible changes"
|
420
435
|
> TODO: list all backward-incompatible changes in this release
|
421
436
|
|
422
|
-
* __________ has been __________ to __________
|
437
|
+
* __________ has been __________ to __________ ---contributor name
|
423
438
|
|
424
|
-
* __________
|
439
|
+
* __________ ---contributor name
|
425
440
|
|
426
|
-
* __________
|
427
|
-
<% end %>
|
441
|
+
* __________ ---contributor name
|
428
442
|
|
429
|
-
|
443
|
+
%|paragraph "New features"
|
430
444
|
> TODO: list new features added in this release
|
431
445
|
|
432
|
-
* __________
|
446
|
+
* __________ ---contributor name
|
433
447
|
|
434
|
-
* __________
|
448
|
+
* __________ ---contributor name
|
435
449
|
|
436
|
-
* __________
|
437
|
-
<% end %>
|
450
|
+
* __________ ---contributor name
|
438
451
|
|
439
|
-
|
452
|
+
%|paragraph "Bug fixes"
|
440
453
|
> TODO: describe all bugs that are fixed in this release
|
441
454
|
|
442
|
-
* __________ was __________
|
455
|
+
* __________ was __________ ---contributor name
|
443
456
|
|
444
|
-
* __________ were __________
|
457
|
+
* __________ were __________ ---contributor name
|
445
458
|
|
446
|
-
* __________ did __________
|
447
|
-
<% end %>
|
459
|
+
* __________ did __________ ---contributor name
|
448
460
|
|
449
|
-
|
461
|
+
%|paragraph "Housekeeping"
|
450
462
|
> TODO: list the refactorings, clean ups, and other
|
451
463
|
> improvements that were done for this release
|
452
464
|
|
453
|
-
* __________
|
465
|
+
* __________ ---contributor name
|
454
466
|
|
455
|
-
* __________
|
467
|
+
* __________ ---contributor name
|
456
468
|
|
457
|
-
* __________
|
458
|
-
<% end %>
|
459
|
-
<% end %>
|
460
|
-
<% end %>
|
461
|
-
<% end %>
|
469
|
+
* __________ ---contributor name
|
462
470
|
}
|
@@ -0,0 +1,370 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Array</title>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
|
10
|
+
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
+
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
+
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div class="banner">
|
17
|
+
<h1>
|
18
|
+
<span class="type">Class</span>
|
19
|
+
Array
|
20
|
+
|
21
|
+
<span class="parent"><
|
22
|
+
|
23
|
+
Object
|
24
|
+
|
25
|
+
</span>
|
26
|
+
|
27
|
+
</h1>
|
28
|
+
<ul class="files">
|
29
|
+
|
30
|
+
<li><a href="../files/lib/inochi/util/combo_rb.html">lib/inochi/util/combo.rb</a></li>
|
31
|
+
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div id="bodyContent">
|
35
|
+
<div id="content">
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
<div class="sectiontitle">Methods</div>
|
46
|
+
<dl class="methods">
|
47
|
+
|
48
|
+
<dt>C</dt>
|
49
|
+
<dd>
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li><a href="#M000002">combination</a>,</li>
|
53
|
+
|
54
|
+
<li><a href="#M000003">combinations</a></li>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
</dd>
|
58
|
+
|
59
|
+
<dt>E</dt>
|
60
|
+
<dd>
|
61
|
+
<ul>
|
62
|
+
|
63
|
+
<li><a href="#M000000">enumeration</a>,</li>
|
64
|
+
|
65
|
+
<li><a href="#M000001">enumerations</a></li>
|
66
|
+
|
67
|
+
</ul>
|
68
|
+
</dd>
|
69
|
+
|
70
|
+
<dt>P</dt>
|
71
|
+
<dd>
|
72
|
+
<ul>
|
73
|
+
|
74
|
+
<li><a href="#M000004">permutation</a>,</li>
|
75
|
+
|
76
|
+
<li><a href="#M000005">permutations</a></li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<div class="sectiontitle">Instance Public methods</div>
|
96
|
+
|
97
|
+
<div class="method">
|
98
|
+
<div class="title" id="M000002">
|
99
|
+
|
100
|
+
<a name="M000002"></a><b>combination</b>(sample_size = self.length, &sampler)
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<div class="description">
|
105
|
+
<p>
|
106
|
+
Returns all possible combinations made from sample_size number of items
|
107
|
+
from this list.
|
108
|
+
</p>
|
109
|
+
<h4>Parameters</h4>
|
110
|
+
<dl>
|
111
|
+
<dt>sample_size</dt><dd>The length of each combination.
|
112
|
+
|
113
|
+
</dd>
|
114
|
+
<dt>sampler</dt><dd>If given, each combination is passed to this block.
|
115
|
+
|
116
|
+
</dd>
|
117
|
+
</dl>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<div class="sourcecode">
|
125
|
+
<p class="source-link">
|
126
|
+
Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
|
127
|
+
|
128
|
+
| <a href="http://github.com/sunaku/inochi/blob/766b14740d2fffe75a0e4a11fd807c391e1f0c66/lib/inochi/util/combo.rb#L70" target="_blank" class="github_url">on GitHub</a>
|
129
|
+
|
130
|
+
</p>
|
131
|
+
<div id="M000002_source" class="dyn-source">
|
132
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/util/combo.rb, line 70</span>
|
133
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">combination</span>(<span class="ruby-identifier">sample_size</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>)
|
134
|
+
<span class="ruby-identifier">pnk_cnk_impl</span>(<span class="ruby-identifier">sample_size</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>)
|
135
|
+
<span class="ruby-keyword kw">end</span></pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="method">
|
142
|
+
<div class="title" id="M000003">
|
143
|
+
|
144
|
+
<a name="M000003"></a><b>combinations</b>(&sampler)
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="description">
|
149
|
+
<p>
|
150
|
+
Returns all possible combinations of all possible lengths.
|
151
|
+
</p>
|
152
|
+
<h4>Parameters</h4>
|
153
|
+
<dl>
|
154
|
+
<dt>sampler</dt><dd>If given, each combination is passed to this block.
|
155
|
+
|
156
|
+
</dd>
|
157
|
+
</dl>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
<div class="sourcecode">
|
165
|
+
<p class="source-link">
|
166
|
+
Source: <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show</a>
|
167
|
+
|
168
|
+
| <a href="http://github.com/sunaku/inochi/blob/766b14740d2fffe75a0e4a11fd807c391e1f0c66/lib/inochi/util/combo.rb#L84" target="_blank" class="github_url">on GitHub</a>
|
169
|
+
|
170
|
+
</p>
|
171
|
+
<div id="M000003_source" class="dyn-source">
|
172
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/util/combo.rb, line 84</span>
|
173
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">combinations</span> <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>
|
174
|
+
<span class="ruby-identifier">all_lengths_impl</span> <span class="ruby-identifier">:combination</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>
|
175
|
+
<span class="ruby-keyword kw">end</span></pre>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="method">
|
182
|
+
<div class="title" id="M000000">
|
183
|
+
|
184
|
+
<a name="M000000"></a><b>enumeration</b>(sample_size = self.length, &sampler)
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div class="description">
|
189
|
+
<p>
|
190
|
+
Returns all possible enumerations made from sample_size number of items
|
191
|
+
from this list.
|
192
|
+
</p>
|
193
|
+
<h4>Parameters</h4>
|
194
|
+
<dl>
|
195
|
+
<dt>sample_size</dt><dd>The length of each enumeration.
|
196
|
+
|
197
|
+
</dd>
|
198
|
+
<dt>sampler</dt><dd>If given, each enumeration is passed to this block.
|
199
|
+
|
200
|
+
</dd>
|
201
|
+
</dl>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div class="sourcecode">
|
209
|
+
<p class="source-link">
|
210
|
+
Source: <a href="javascript:toggleSource('M000000_source')" id="l_M000000_source">show</a>
|
211
|
+
|
212
|
+
| <a href="http://github.com/sunaku/inochi/blob/766b14740d2fffe75a0e4a11fd807c391e1f0c66/lib/inochi/util/combo.rb#L20" target="_blank" class="github_url">on GitHub</a>
|
213
|
+
|
214
|
+
</p>
|
215
|
+
<div id="M000000_source" class="dyn-source">
|
216
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/util/combo.rb, line 20</span>
|
217
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enumeration</span>(<span class="ruby-identifier">sample_size</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>)
|
218
|
+
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sample_size</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span>
|
219
|
+
|
220
|
+
<span class="ruby-identifier">results</span> = []
|
221
|
+
|
222
|
+
<span class="ruby-identifier">visitor</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">parents</span><span class="ruby-operator">|</span>
|
223
|
+
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
|
224
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">parents</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">child</span>]
|
225
|
+
|
226
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">sample_size</span>
|
227
|
+
<span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">result</span>
|
228
|
+
<span class="ruby-keyword kw">else</span>
|
229
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
230
|
+
<span class="ruby-identifier">results</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">result</span>
|
231
|
+
<span class="ruby-keyword kw">end</span>
|
232
|
+
<span class="ruby-keyword kw">end</span>
|
233
|
+
<span class="ruby-keyword kw">end</span>
|
234
|
+
|
235
|
+
<span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">call</span> []
|
236
|
+
<span class="ruby-identifier">results</span>
|
237
|
+
<span class="ruby-keyword kw">end</span></pre>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div class="method">
|
244
|
+
<div class="title" id="M000001">
|
245
|
+
|
246
|
+
<a name="M000001"></a><b>enumerations</b>(&sampler)
|
247
|
+
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="description">
|
251
|
+
<p>
|
252
|
+
Returns all possible enumerations of all possible lengths.
|
253
|
+
</p>
|
254
|
+
<h4>Parameters</h4>
|
255
|
+
<dl>
|
256
|
+
<dt>sampler</dt><dd>If given, each enumeration is passed to this block.
|
257
|
+
|
258
|
+
</dd>
|
259
|
+
</dl>
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<div class="sourcecode">
|
267
|
+
<p class="source-link">
|
268
|
+
Source: <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show</a>
|
269
|
+
|
270
|
+
| <a href="http://github.com/sunaku/inochi/blob/766b14740d2fffe75a0e4a11fd807c391e1f0c66/lib/inochi/util/combo.rb#L52" target="_blank" class="github_url">on GitHub</a>
|
271
|
+
|
272
|
+
</p>
|
273
|
+
<div id="M000001_source" class="dyn-source">
|
274
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/util/combo.rb, line 52</span>
|
275
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enumerations</span> <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>
|
276
|
+
<span class="ruby-identifier">all_lengths_impl</span> <span class="ruby-identifier">:enumeration</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>
|
277
|
+
<span class="ruby-keyword kw">end</span></pre>
|
278
|
+
</div>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<div class="method">
|
284
|
+
<div class="title" id="M000004">
|
285
|
+
|
286
|
+
<a name="M000004"></a><b>permutation</b>(sample_size = self.length, &sampler)
|
287
|
+
|
288
|
+
</div>
|
289
|
+
|
290
|
+
<div class="description">
|
291
|
+
<p>
|
292
|
+
Returns all possible permutations made from sample_size number of items
|
293
|
+
from this list.
|
294
|
+
</p>
|
295
|
+
<h4>Parameters</h4>
|
296
|
+
<dl>
|
297
|
+
<dt>sample_size</dt><dd>The length of each permutation.
|
298
|
+
|
299
|
+
</dd>
|
300
|
+
<dt>sampler</dt><dd>If given, each permutation is passed to this block.
|
301
|
+
|
302
|
+
</dd>
|
303
|
+
</dl>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
<div class="sourcecode">
|
311
|
+
<p class="source-link">
|
312
|
+
Source: <a href="javascript:toggleSource('M000004_source')" id="l_M000004_source">show</a>
|
313
|
+
|
314
|
+
| <a href="http://github.com/sunaku/inochi/blob/766b14740d2fffe75a0e4a11fd807c391e1f0c66/lib/inochi/util/combo.rb#L102" target="_blank" class="github_url">on GitHub</a>
|
315
|
+
|
316
|
+
</p>
|
317
|
+
<div id="M000004_source" class="dyn-source">
|
318
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/util/combo.rb, line 102</span>
|
319
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">permutation</span>(<span class="ruby-identifier">sample_size</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>)
|
320
|
+
<span class="ruby-identifier">pnk_cnk_impl</span>(<span class="ruby-identifier">sample_size</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>)
|
321
|
+
<span class="ruby-keyword kw">end</span></pre>
|
322
|
+
</div>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div class="method">
|
328
|
+
<div class="title" id="M000005">
|
329
|
+
|
330
|
+
<a name="M000005"></a><b>permutations</b>(&sampler)
|
331
|
+
|
332
|
+
</div>
|
333
|
+
|
334
|
+
<div class="description">
|
335
|
+
<p>
|
336
|
+
Returns all possible permutations of all possible lengths.
|
337
|
+
</p>
|
338
|
+
<h4>Parameters</h4>
|
339
|
+
<dl>
|
340
|
+
<dt>sampler</dt><dd>If given, each permutation is passed to this block.
|
341
|
+
|
342
|
+
</dd>
|
343
|
+
</dl>
|
344
|
+
|
345
|
+
</div>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
<div class="sourcecode">
|
351
|
+
<p class="source-link">
|
352
|
+
Source: <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show</a>
|
353
|
+
|
354
|
+
| <a href="http://github.com/sunaku/inochi/blob/766b14740d2fffe75a0e4a11fd807c391e1f0c66/lib/inochi/util/combo.rb#L116" target="_blank" class="github_url">on GitHub</a>
|
355
|
+
|
356
|
+
</p>
|
357
|
+
<div id="M000005_source" class="dyn-source">
|
358
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/util/combo.rb, line 116</span>
|
359
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">permutations</span> <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>
|
360
|
+
<span class="ruby-identifier">all_lengths_impl</span> <span class="ruby-identifier">:permutation</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">sampler</span>
|
361
|
+
<span class="ruby-keyword kw">end</span></pre>
|
362
|
+
</div>
|
363
|
+
</div>
|
364
|
+
|
365
|
+
</div>
|
366
|
+
|
367
|
+
</div>
|
368
|
+
</div>
|
369
|
+
</body>
|
370
|
+
</html>
|