combos 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2dcbe7b309429be77e18d6c86ca86bb68e58d5ac
4
+ data.tar.gz: f500e5679798993844a50ae240aa396c223aca7c
5
+ SHA512:
6
+ metadata.gz: d66cecdf62048579e71755a8991ecd1cf6b8e31e622e29ea1db2ac523ae566a6365b74780eedcffbc59cbdc0dc5479e5c54c327b8290f4f17d87200e39bb60b0
7
+ data.tar.gz: 78ce2bf23478dd3f8048a17750f7e37effbf46be419b226f8468aa96b02379c636a015fcb1d78ea1740cb3c58313fa332ef7c31adc9a70779a2d0f910da00bb6
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ # /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.4
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,18 @@
1
+ --title 'Combos: generate combinations of your Arrays'
2
+ --verbose
3
+ #--output-dir './combo_docs'
4
+ --output-dir './docs'
5
+
6
+ #--use-cache
7
+ --protected
8
+ --private
9
+
10
+ #--exclude 'name'
11
+
12
+ --tag 'try: see what comes'
13
+
14
+ -
15
+ README.md
16
+ Combos_intro.md
17
+ CHANGELOG.md
18
+ LICENSE.txt
@@ -0,0 +1,4 @@
1
+ # Combos ChangeLog
2
+
3
+ Lets see how many versions we are having to release
4
+
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ufo2mstar@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,23 @@
1
+ # Intro to Combos
2
+ Say you have a few Arrays of different objects,
3
+ and were tasked with finding out reliable way to work out the
4
+ different possible combination of things you have in that array.
5
+
6
+ Lets see some examples:
7
+
8
+ ## Pairing
9
+ For this instance, I am going to illustrate things with Three Sample Arrays that you have
10
+ ```ruby
11
+ words = %w[a b c]
12
+ numbs = [1,2,3]
13
+ chars = ['#','!']
14
+ ````
15
+
16
+ more examples will follow
17
+
18
+ ### Power Pair
19
+ ### Serial Pair
20
+ ### Random Pair
21
+ #### Repeatable Random
22
+
23
+ ### Combo Pair
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in combos.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Naren SivaSubramani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # Combos
2
+
3
+ Thanks for trying out my Ruby Combinator. Hope it serves your purpose!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'combos'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install combos
20
+
21
+ ## Usage
22
+
23
+ There is comprehensive documentation added to Combos_intro.md
24
+ More info may be added to the Wiki in the future, as needed.
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bin/setup` to install dependencies.
29
+ Then, run `rake spec` to run the tests.
30
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
+
32
+ To install this gem onto your local machine, run `bundle exec rake install`.
33
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ufo2mstar/combos.
38
+ As always, this project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
+
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
44
+
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ require 'yard'
9
+
10
+ YARD::Rake::YardocTask.new do |t|
11
+ t.files = ['lib/**', 'spec/**']
12
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "combos"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'combos/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "combos"
8
+ spec.version = Combos::VERSION
9
+ spec.authors = ["Naren SivaSubramani"]
10
+ spec.email = ["ufo2mstar@gmail.com"]
11
+
12
+ spec.summary = Combos::SPEC_SUMMARY
13
+ spec.description = Combos::SPEC_DESCRIPTION
14
+ # spec.homepage = Combos::SPEC_HOMEPAGE
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # spec.metadata['allowed_push_host'] = Combos::SPEC_METADATA
22
+ # else
23
+ # raise "RubyGems 2.0 or newer is required to protect against " \
24
+ # "public gem pushes."
25
+ # end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.13"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "yard", "~> 0.7"
38
+ end
@@ -0,0 +1,1026 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Combos
8
+
9
+ &mdash; Combos: generate combinations of your Arrays
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Combos";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (C)</a> &raquo;
40
+
41
+
42
+ <span class="title">Combos</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame" src="class_list.html"></iframe>
63
+
64
+ <div id="content"><h1>Module: Combos
65
+
66
+
67
+
68
+ </h1>
69
+ <div class="box_info">
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dl>
82
+ <dt>Defined in:</dt>
83
+ <dd>lib/combos.rb<span class="defines">,<br />
84
+ lib/combos/version.rb,<br /> lib/combos/match_maker.rb</span>
85
+ </dd>
86
+ </dl>
87
+
88
+ </div>
89
+
90
+
91
+ <h2>Constant Summary</h2>
92
+ <dl class="constants">
93
+
94
+ <dt id="VERSION-constant" class="">VERSION =
95
+
96
+ </dt>
97
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
98
+
99
+ <dt id="SPEC_SUMMARY-constant" class="">SPEC_SUMMARY =
100
+
101
+ </dt>
102
+ <dd><pre class="code"><span class='heredoc_beg'>&lt;&lt;EOF</span>
103
+ <span class='tstring_content'>A helpful gem that can be used to generate combinations on the fly~
104
+ </span><span class='heredoc_end'>EOF</span></pre></dd>
105
+
106
+ <dt id="SPEC_DESCRIPTION-constant" class="">SPEC_DESCRIPTION =
107
+
108
+ </dt>
109
+ <dd><pre class="code"><span class='heredoc_beg'>&lt;&lt;EOF</span>
110
+ <span class='tstring_content'>Provides methods in the Combos module that you can use for: power_pair serial_pair random_pair combo_pair
111
+ </span><span class='heredoc_end'>EOF</span></pre></dd>
112
+
113
+ <dt id="SPEC_HOMEPAGE-constant" class="">SPEC_HOMEPAGE =
114
+
115
+ </dt>
116
+ <dd><pre class="code"><span class='heredoc_beg'>&lt;&lt;EOF</span>
117
+ <span class='tstring_content'>https://ufo2mstar.github.io/combos/docs/
118
+ </span><span class='heredoc_end'>EOF</span></pre></dd>
119
+
120
+ <dt id="SPEC_METADATA-constant" class="">SPEC_METADATA =
121
+
122
+ </dt>
123
+ <dd><pre class="code"><span class='heredoc_beg'>&lt;&lt;EOF</span>
124
+ <span class='tstring_content'>http://mygemserver.com&#39;&quot;
125
+ </span><span class='heredoc_end'>EOF</span></pre></dd>
126
+
127
+ </dl>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <h2>
137
+ Instance Method Summary
138
+ <small><a href="#" class="summary_toggle">collapse</a></small>
139
+ </h2>
140
+
141
+ <ul class="summary">
142
+
143
+ <li class="private ">
144
+ <span class="summary_signature">
145
+
146
+ <a href="#brute_pair-instance_method" title="#brute_pair (instance method)">#<strong>brute_pair</strong>(*true_params, &amp;blk) &#x21d2; Array(Arrays(Objects)) </a>
147
+
148
+
149
+
150
+ </span>
151
+
152
+
153
+
154
+ <span class="note title private">private</span>
155
+
156
+
157
+
158
+
159
+
160
+ <span class="summary_desc"><div class='inline'>
161
+ <p>The Array of combinations.</p>
162
+ </div></span>
163
+
164
+ </li>
165
+
166
+
167
+ <li class="public ">
168
+ <span class="summary_signature">
169
+
170
+ <a href="#combo_pair-instance_method" title="#combo_pair (instance method)">#<strong>combo_pair</strong>(num, *params, &amp;blk) &#x21d2; Object </a>
171
+
172
+
173
+
174
+ </span>
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+ <span class="summary_desc"><div class='inline'>
185
+ <p>Generates <span class='object_link'><a href="" title="Combos (module)">Combos</a></span> to hit All the variables atleast once.</p>
186
+ </div></span>
187
+
188
+ </li>
189
+
190
+
191
+ <li class="public ">
192
+ <span class="summary_signature">
193
+
194
+ <a href="#power_pair-instance_method" title="#power_pair (instance method)">#<strong>power_pair</strong>(*params, &amp;blk) &#x21d2; Object </a>
195
+
196
+
197
+
198
+ </span>
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+ <span class="summary_desc"><div class='inline'>
209
+ <p>Generates All possible <span class='object_link'><a href="" title="Combos (module)">Combos</a></span> of all your array elements.</p>
210
+ </div></span>
211
+
212
+ </li>
213
+
214
+
215
+ <li class="public ">
216
+ <span class="summary_signature">
217
+
218
+ <a href="#random_pair-instance_method" title="#random_pair (instance method)">#<strong>random_pair</strong>(*params, &amp;blk) &#x21d2; Object </a>
219
+
220
+
221
+
222
+ </span>
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+ <span class="summary_desc"><div class='inline'></div></span>
233
+
234
+ </li>
235
+
236
+
237
+ <li class="public ">
238
+ <span class="summary_signature">
239
+
240
+ <a href="#serial_pair-instance_method" title="#serial_pair (instance method)">#<strong>serial_pair</strong>(*params, &amp;blk) &#x21d2; Object </a>
241
+
242
+
243
+
244
+ </span>
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ <span class="summary_desc"><div class='inline'>
255
+ <p>Generates <span class='object_link'><a href="" title="Combos (module)">Combos</a></span> to hit All the variables atleast once.</p>
256
+ </div></span>
257
+
258
+ </li>
259
+
260
+
261
+ <li class="private ">
262
+ <span class="summary_signature">
263
+
264
+ <a href="#smart_pair-instance_method" title="#smart_pair (instance method)">#<strong>smart_pair</strong>(rnd = nil, *true_params, &amp;blk) &#x21d2; Array(Arrays(Objects)) </a>
265
+
266
+
267
+
268
+ </span>
269
+
270
+
271
+
272
+ <span class="note title private">private</span>
273
+
274
+
275
+
276
+
277
+
278
+ <span class="summary_desc"><div class='inline'>
279
+ <p>The Array of combinations.</p>
280
+ </div></span>
281
+
282
+ </li>
283
+
284
+
285
+ <li class="protected ">
286
+ <span class="summary_signature">
287
+
288
+ <a href="#vprint-instance_method" title="#vprint (instance method)">#<strong>vprint</strong>(*args) &#x21d2; Object </a>
289
+
290
+
291
+
292
+ </span>
293
+
294
+
295
+
296
+ <span class="note title protected">protected</span>
297
+
298
+
299
+
300
+
301
+
302
+ <span class="summary_desc"><div class='inline'>
303
+ <p>print if $VERBOSE flag is truthy.</p>
304
+ </div></span>
305
+
306
+ </li>
307
+
308
+
309
+ <li class="protected ">
310
+ <span class="summary_signature">
311
+
312
+ <a href="#vputs-instance_method" title="#vputs (instance method)">#<strong>vputs</strong>(*args) &#x21d2; Object </a>
313
+
314
+
315
+
316
+ </span>
317
+
318
+
319
+
320
+ <span class="note title protected">protected</span>
321
+
322
+
323
+
324
+
325
+
326
+ <span class="summary_desc"><div class='inline'>
327
+ <p>puts if $VERBOSE flag is truthy.</p>
328
+ </div></span>
329
+
330
+ </li>
331
+
332
+
333
+ </ul>
334
+
335
+
336
+
337
+
338
+ <div id="instance_method_details" class="method_details_list">
339
+ <h2>Instance Method Details</h2>
340
+
341
+
342
+ <div class="method_details first">
343
+ <h3 class="signature first" id="brute_pair-instance_method">
344
+
345
+ #<strong>brute_pair</strong>(*true_params, &amp;blk) &#x21d2; <tt>Array(Arrays(Objects))</tt> <span class="extras">(private)</span>
346
+
347
+
348
+
349
+
350
+
351
+ </h3><div class="docstring">
352
+ <div class="discussion">
353
+
354
+ <p>Returns the Array of combinations</p>
355
+
356
+
357
+ </div>
358
+ </div>
359
+ <div class="tags">
360
+ <p class="tag_title">Parameters:</p>
361
+ <ul class="param">
362
+
363
+ <li>
364
+
365
+ <span class='name'>true_params</span>
366
+
367
+
368
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
369
+
370
+
371
+
372
+ </li>
373
+
374
+ <li>
375
+
376
+ <span class='name'>blk</span>
377
+
378
+
379
+ <span class='type'>(<tt>Block</tt>)</span>
380
+
381
+
382
+
383
+ </li>
384
+
385
+ </ul>
386
+
387
+ <p class="tag_title">Yield Returns:</p>
388
+ <ul class="yieldreturn">
389
+
390
+ <li>
391
+
392
+
393
+ <span class='type'>(<tt>Array(Objects)</tt>)</span>
394
+
395
+
396
+
397
+ &mdash;
398
+ <div class='inline'>
399
+ <p>yields to the block if &amp;blk is provided</p>
400
+ </div>
401
+
402
+ </li>
403
+
404
+ </ul>
405
+ <p class="tag_title">Returns:</p>
406
+ <ul class="return">
407
+
408
+ <li>
409
+
410
+
411
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
412
+
413
+
414
+
415
+ &mdash;
416
+ <div class='inline'>
417
+ <p>the Array of combinations</p>
418
+ </div>
419
+
420
+ </li>
421
+
422
+ </ul>
423
+
424
+ </div><table class="source_code">
425
+ <tr>
426
+ <td>
427
+ <pre class="lines">
428
+
429
+
430
+ 57
431
+ 58
432
+ 59
433
+ 60
434
+ 61
435
+ 62
436
+ 63</pre>
437
+ </td>
438
+ <td>
439
+ <pre class="code"><span class="info file"># File 'lib/combos/match_maker.rb', line 57</span>
440
+
441
+ <span class='kw'>def</span> <span class='id identifier rubyid_brute_pair'>brute_pair</span> <span class='op'>*</span><span class='id identifier rubyid_true_params'>true_params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
442
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_true_params'>true_params</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:dup</span><span class='rparen'>)</span>
443
+ <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span><span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
444
+ <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_eval'>eval</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@a</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='embexpr_end'>}</span><span class='tstring_content'> = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_a'>a</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
445
+ <span class='ivar'>@combos</span> <span class='op'>=</span> <span class='id identifier rubyid_n'>n</span><span class='op'>!=</span><span class='int'>1</span> <span class='op'>?</span> <span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>@a0</span><span class='tstring_end'>&#39;</span></span><span class='semicolon'>;</span> <span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_k'>k</span><span class='op'>+=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.product(@a</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span><span class='semicolon'>;</span> <span class='id identifier rubyid_k'>k</span><span class='op'>+=</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.map(&amp;:flatten)</span><span class='tstring_end'>&quot;</span></span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>:</span> <span class='ivar'>@a0</span> <span class='comment'>#.map{|x|[x]}
446
+ </span> <span class='id identifier rubyid_blk'>blk</span> <span class='op'>?</span> <span class='ivar'>@combos</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='kw'>yield</span> <span class='id identifier rubyid_a'>a</span> <span class='rbrace'>}</span> <span class='op'>:</span> <span class='ivar'>@combos</span>
447
+ <span class='kw'>end</span></pre>
448
+ </td>
449
+ </tr>
450
+ </table>
451
+ </div>
452
+
453
+ <div class="method_details ">
454
+ <h3 class="signature " id="combo_pair-instance_method">
455
+
456
+ #<strong>combo_pair</strong>(num, *params, &amp;blk) &#x21d2; <tt>Object</tt>
457
+
458
+
459
+
460
+
461
+
462
+ </h3><div class="docstring">
463
+ <div class="discussion">
464
+
465
+ <p>Generates <span class='object_link'><a href="" title="Combos (module)">Combos</a></span> to hit All the variables atleast once</p>
466
+
467
+
468
+ </div>
469
+ </div>
470
+ <div class="tags">
471
+
472
+
473
+ </div><table class="source_code">
474
+ <tr>
475
+ <td>
476
+ <pre class="lines">
477
+
478
+
479
+ 30
480
+ 31
481
+ 32</pre>
482
+ </td>
483
+ <td>
484
+ <pre class="code"><span class="info file"># File 'lib/combos.rb', line 30</span>
485
+
486
+ <span class='kw'>def</span> <span class='id identifier rubyid_combo_pair'>combo_pair</span> <span class='id identifier rubyid_num'>num</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
487
+ <span class='id identifier rubyid_smart_pair'>smart_pair</span> <span class='id identifier rubyid_num'>num</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
488
+ <span class='kw'>end</span></pre>
489
+ </td>
490
+ </tr>
491
+ </table>
492
+ </div>
493
+
494
+ <div class="method_details ">
495
+ <h3 class="signature " id="power_pair-instance_method">
496
+
497
+ #<strong>power_pair</strong>(*params, &amp;blk) &#x21d2; <tt>Object</tt>
498
+
499
+
500
+
501
+
502
+
503
+ </h3><div class="docstring">
504
+ <div class="discussion">
505
+
506
+ <p>Generates All possible <span class='object_link'><a href="" title="Combos (module)">Combos</a></span> of all your array elements</p>
507
+
508
+
509
+ </div>
510
+ </div>
511
+ <div class="tags">
512
+ <p class="tag_title">Parameters:</p>
513
+ <ul class="param">
514
+
515
+ <li>
516
+
517
+ <span class='name'>params</span>
518
+
519
+
520
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
521
+
522
+
523
+
524
+ </li>
525
+
526
+ <li>
527
+
528
+ <span class='name'>blk</span>
529
+
530
+
531
+ <span class='type'>(<tt>Object</tt>)</span>
532
+
533
+
534
+
535
+ </li>
536
+
537
+ </ul>
538
+
539
+
540
+ <p class="tag_title">See Also:</p>
541
+ <ul class="see">
542
+
543
+ <li><span class='object_link'><a href="#brute_pair-instance_method" title="Combos#brute_pair (method)">#brute_pair</a></span></li>
544
+
545
+ </ul>
546
+
547
+ </div><table class="source_code">
548
+ <tr>
549
+ <td>
550
+ <pre class="lines">
551
+
552
+
553
+ 10
554
+ 11
555
+ 12</pre>
556
+ </td>
557
+ <td>
558
+ <pre class="code"><span class="info file"># File 'lib/combos.rb', line 10</span>
559
+
560
+ <span class='kw'>def</span> <span class='id identifier rubyid_power_pair'>power_pair</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
561
+ <span class='id identifier rubyid_brute_pair'>brute_pair</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
562
+ <span class='kw'>end</span></pre>
563
+ </td>
564
+ </tr>
565
+ </table>
566
+ </div>
567
+
568
+ <div class="method_details ">
569
+ <h3 class="signature " id="random_pair-instance_method">
570
+
571
+ #<strong>random_pair</strong>(*params, &amp;blk) &#x21d2; <tt>Object</tt>
572
+
573
+
574
+
575
+
576
+
577
+ </h3><div class="docstring">
578
+ <div class="discussion">
579
+
580
+
581
+ </div>
582
+ </div>
583
+ <div class="tags">
584
+ <p class="tag_title">Parameters:</p>
585
+ <ul class="param">
586
+
587
+ <li>
588
+
589
+ <span class='name'>params</span>
590
+
591
+
592
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
593
+
594
+
595
+
596
+ </li>
597
+
598
+ <li>
599
+
600
+ <span class='name'>blk</span>
601
+
602
+
603
+ <span class='type'>(<tt>Object</tt>)</span>
604
+
605
+
606
+
607
+ </li>
608
+
609
+ </ul>
610
+
611
+
612
+ <p class="tag_title">See Also:</p>
613
+ <ul class="see">
614
+
615
+ <li><span class='object_link'><a href="#smart_pair-instance_method" title="Combos#smart_pair (method)">#smart_pair</a></span></li>
616
+
617
+ </ul>
618
+
619
+ </div><table class="source_code">
620
+ <tr>
621
+ <td>
622
+ <pre class="lines">
623
+
624
+
625
+ 25
626
+ 26
627
+ 27</pre>
628
+ </td>
629
+ <td>
630
+ <pre class="code"><span class="info file"># File 'lib/combos.rb', line 25</span>
631
+
632
+ <span class='kw'>def</span> <span class='id identifier rubyid_random_pair'>random_pair</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
633
+ <span class='id identifier rubyid_smart_pair'>smart_pair</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>rand</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
634
+ <span class='kw'>end</span></pre>
635
+ </td>
636
+ </tr>
637
+ </table>
638
+ </div>
639
+
640
+ <div class="method_details ">
641
+ <h3 class="signature " id="serial_pair-instance_method">
642
+
643
+ #<strong>serial_pair</strong>(*params, &amp;blk) &#x21d2; <tt>Object</tt>
644
+
645
+
646
+
647
+
648
+
649
+ </h3><div class="docstring">
650
+ <div class="discussion">
651
+
652
+ <p>Generates <span class='object_link'><a href="" title="Combos (module)">Combos</a></span> to hit All the variables atleast once</p>
653
+
654
+
655
+ </div>
656
+ </div>
657
+ <div class="tags">
658
+ <p class="tag_title">Parameters:</p>
659
+ <ul class="param">
660
+
661
+ <li>
662
+
663
+ <span class='name'>params</span>
664
+
665
+
666
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
667
+
668
+
669
+
670
+ </li>
671
+
672
+ <li>
673
+
674
+ <span class='name'>blk</span>
675
+
676
+
677
+ <span class='type'>(<tt>Object</tt>)</span>
678
+
679
+
680
+
681
+ </li>
682
+
683
+ </ul>
684
+
685
+
686
+ <p class="tag_title">See Also:</p>
687
+ <ul class="see">
688
+
689
+ <li><span class='object_link'><a href="#smart_pair-instance_method" title="Combos#smart_pair (method)">#smart_pair</a></span></li>
690
+
691
+ </ul>
692
+
693
+ </div><table class="source_code">
694
+ <tr>
695
+ <td>
696
+ <pre class="lines">
697
+
698
+
699
+ 18
700
+ 19
701
+ 20</pre>
702
+ </td>
703
+ <td>
704
+ <pre class="code"><span class="info file"># File 'lib/combos.rb', line 18</span>
705
+
706
+ <span class='kw'>def</span> <span class='id identifier rubyid_serial_pair'>serial_pair</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
707
+ <span class='id identifier rubyid_smart_pair'>smart_pair</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
708
+ <span class='kw'>end</span></pre>
709
+ </td>
710
+ </tr>
711
+ </table>
712
+ </div>
713
+
714
+ <div class="method_details ">
715
+ <h3 class="signature " id="smart_pair-instance_method">
716
+
717
+ #<strong>smart_pair</strong>(rnd = nil, *true_params, &amp;blk) &#x21d2; <tt>Array(Arrays(Objects))</tt> <span class="extras">(private)</span>
718
+
719
+
720
+
721
+
722
+
723
+ </h3><div class="docstring">
724
+ <div class="discussion">
725
+
726
+ <p>Returns the Array of combinations</p>
727
+
728
+
729
+ </div>
730
+ </div>
731
+ <div class="tags">
732
+ <p class="tag_title">Parameters:</p>
733
+ <ul class="param">
734
+
735
+ <li>
736
+
737
+ <span class='name'>true_params</span>
738
+
739
+
740
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
741
+
742
+
743
+
744
+ &mdash;
745
+ <div class='inline'>
746
+ <p>Array of the different Object Arrays for pairing</p>
747
+ </div>
748
+
749
+ </li>
750
+
751
+ <li>
752
+
753
+ <span class='name'>blk</span>
754
+
755
+
756
+ <span class='type'>(<tt>Object</tt>)</span>
757
+
758
+
759
+
760
+ </li>
761
+
762
+ <li>
763
+
764
+ <span class='name'>[Nil]</span>
765
+
766
+
767
+ <span class='type'>(<tt>Hash</tt>)</span>
768
+
769
+
770
+
771
+ &mdash;
772
+ <div class='inline'>
773
+ <p>a customizable set of options</p>
774
+ </div>
775
+
776
+ </li>
777
+
778
+ <li>
779
+
780
+ <span class='name'>[String]</span>
781
+
782
+
783
+ <span class='type'>(<tt>Hash</tt>)</span>
784
+
785
+
786
+
787
+ &mdash;
788
+ <div class='inline'>
789
+ <p>a customizable set of options</p>
790
+ </div>
791
+
792
+ </li>
793
+
794
+ <li>
795
+
796
+ <span class='name'>[Integer]</span>
797
+
798
+
799
+ <span class='type'>(<tt>Hash</tt>)</span>
800
+
801
+
802
+
803
+ &mdash;
804
+ <div class='inline'>
805
+ <p>a customizable set of options</p>
806
+ </div>
807
+
808
+ </li>
809
+
810
+ </ul>
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+ <p class="tag_title">Yield Returns:</p>
821
+ <ul class="yieldreturn">
822
+
823
+ <li>
824
+
825
+
826
+ <span class='type'>(<tt>Array(Objects)</tt>)</span>
827
+
828
+
829
+
830
+ &mdash;
831
+ <div class='inline'>
832
+ <p>yields to the block if &amp;blk is provided</p>
833
+ </div>
834
+
835
+ </li>
836
+
837
+ </ul>
838
+ <p class="tag_title">Returns:</p>
839
+ <ul class="return">
840
+
841
+ <li>
842
+
843
+
844
+ <span class='type'>(<tt>Array(Arrays(Objects))</tt>)</span>
845
+
846
+
847
+
848
+ &mdash;
849
+ <div class='inline'>
850
+ <p>the Array of combinations</p>
851
+ </div>
852
+
853
+ </li>
854
+
855
+ </ul>
856
+
857
+ </div><table class="source_code">
858
+ <tr>
859
+ <td>
860
+ <pre class="lines">
861
+
862
+
863
+ 22
864
+ 23
865
+ 24
866
+ 25
867
+ 26
868
+ 27
869
+ 28
870
+ 29
871
+ 30
872
+ 31
873
+ 32
874
+ 33
875
+ 34
876
+ 35
877
+ 36
878
+ 37
879
+ 38
880
+ 39
881
+ 40
882
+ 41
883
+ 42
884
+ 43
885
+ 44
886
+ 45
887
+ 46
888
+ 47
889
+ 48
890
+ 49
891
+ 50
892
+ 51</pre>
893
+ </td>
894
+ <td>
895
+ <pre class="code"><span class="info file"># File 'lib/combos/match_maker.rb', line 22</span>
896
+
897
+ <span class='kw'>def</span> <span class='id identifier rubyid_smart_pair'>smart_pair</span> <span class='id identifier rubyid_rnd'>rnd</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_true_params'>true_params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span>
898
+ <span class='id identifier rubyid_safe_quit'>safe_quit</span><span class='op'>=</span><span class='tlambda'>-&gt;</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_vputs'>vputs</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>exiting smart_pair</span><span class='tstring_end'>&quot;</span></span><span class='semicolon'>;</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
899
+ <span class='kw'>begin</span>
900
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_true_params'>true_params</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:dup</span><span class='rparen'>)</span>
901
+ <span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
902
+ <span class='id identifier rubyid_vputs'>vputs</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
903
+ <span class='kw'>return</span> <span class='id identifier rubyid_safe_quit'>safe_quit</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
904
+ <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
905
+ <span class='id identifier rubyid_vputs'>vputs</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
906
+ <span class='kw'>return</span> <span class='id identifier rubyid_safe_quit'>safe_quit</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
907
+ <span class='kw'>end</span>
908
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
909
+ <span class='lparen'>(</span><span class='id identifier rubyid_vprint'>vprint</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>params are empty..</span><span class='tstring_end'>&quot;</span></span><span class='semicolon'>;</span> <span class='kw'>return</span> <span class='id identifier rubyid_safe_quit'>safe_quit</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
910
+
911
+ <span class='comment'># if rnd is a number, increase the first ary with rand entries (assuming first ary entry is larger)
912
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_rnd'>rnd</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Fixnum</span>
913
+ <span class='id identifier rubyid_src_ary'>src_ary</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
914
+ <span class='id identifier rubyid_diff'>diff</span> <span class='op'>=</span> <span class='id identifier rubyid_rnd'>rnd</span> <span class='op'>-</span> <span class='id identifier rubyid_src_ary'>src_ary</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
915
+ <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_diff'>diff</span><span class='op'>&lt;</span><span class='int'>1</span> <span class='op'>?</span> <span class='lparen'>(</span><span class='id identifier rubyid_diff'>diff</span> <span class='op'>=</span> <span class='id identifier rubyid_rnd'>rnd</span><span class='semicolon'>;</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_src_ary'>src_ary</span> <span class='comment'># assign blank and make the rnd sampling == rnd
916
+ </span> <span class='id identifier rubyid_res'>res</span> <span class='op'>+=</span> <span class='id identifier rubyid_diff'>diff</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span> <span class='op'>|</span> <span class='id identifier rubyid_src_ary'>src_ary</span><span class='period'>.</span><span class='id identifier rubyid_sample'>sample</span> <span class='rbrace'>}</span>
917
+ <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span>
918
+ <span class='kw'>end</span>
919
+ <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span><span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
920
+ <span class='lparen'>(</span><span class='id identifier rubyid_vputs'>vputs</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No Ary passed for smart_pairing</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:rnd</span><span class='semicolon'>;</span> <span class='kw'>return</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>==</span> <span class='int'>0</span>
921
+ <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_eval'>eval</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@a</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='embexpr_end'>}</span><span class='tstring_content'> = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_a'>a</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
922
+ <span class='id identifier rubyid_lim'>lim</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_max_by'>max_by</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:length</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
923
+ <span class='id identifier rubyid_rand_samp'>rand_samp</span> <span class='op'>=</span><span class='tlambda'>-&gt;</span> <span class='id identifier rubyid_ary'>ary</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_ary'>ary</span><span class='period'>.</span><span class='id identifier rubyid_shuffle!'>shuffle!</span> <span class='kw'>if</span> <span class='id identifier rubyid_rnd'>rnd</span><span class='semicolon'>;</span> <span class='id identifier rubyid_ary'>ary</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span> <span class='rbrace'>}</span>
924
+ <span class='ivar'>@combos</span> <span class='op'>=</span> <span class='id identifier rubyid_lim'>lim</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_ary'>ary</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_eval'>eval</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ary=[@a</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='embexpr_end'>}</span><span class='tstring_content'>.sample]</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_ary'>ary</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='semicolon'>;</span> <span class='id identifier rubyid_rand_samp'>rand_samp</span><span class='lbracket'>[</span><span class='id identifier rubyid_ary'>ary</span><span class='rbracket'>]</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
925
+ <span class='id identifier rubyid_blk'>blk</span> <span class='op'>?</span> <span class='ivar'>@combos</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='kw'>yield</span> <span class='id identifier rubyid_a'>a</span> <span class='rbrace'>}</span> <span class='op'>:</span> <span class='ivar'>@combos</span>
926
+ <span class='kw'>end</span></pre>
927
+ </td>
928
+ </tr>
929
+ </table>
930
+ </div>
931
+
932
+ <div class="method_details ">
933
+ <h3 class="signature " id="vprint-instance_method">
934
+
935
+ #<strong>vprint</strong>(*args) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
936
+
937
+
938
+
939
+
940
+
941
+ </h3><div class="docstring">
942
+ <div class="discussion">
943
+
944
+ <p>print if $VERBOSE flag is truthy</p>
945
+
946
+
947
+ </div>
948
+ </div>
949
+ <div class="tags">
950
+
951
+
952
+ </div><table class="source_code">
953
+ <tr>
954
+ <td>
955
+ <pre class="lines">
956
+
957
+
958
+ 10
959
+ 11
960
+ 12</pre>
961
+ </td>
962
+ <td>
963
+ <pre class="code"><span class="info file"># File 'lib/combos/match_maker.rb', line 10</span>
964
+
965
+ <span class='kw'>def</span> <span class='id identifier rubyid_vprint'>vprint</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span>
966
+ <span class='id identifier rubyid_print'>print</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span> <span class='kw'>if</span> <span class='gvar'>$VERBOSE</span>
967
+ <span class='kw'>end</span></pre>
968
+ </td>
969
+ </tr>
970
+ </table>
971
+ </div>
972
+
973
+ <div class="method_details ">
974
+ <h3 class="signature " id="vputs-instance_method">
975
+
976
+ #<strong>vputs</strong>(*args) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
977
+
978
+
979
+
980
+
981
+
982
+ </h3><div class="docstring">
983
+ <div class="discussion">
984
+
985
+ <p>puts if $VERBOSE flag is truthy</p>
986
+
987
+
988
+ </div>
989
+ </div>
990
+ <div class="tags">
991
+
992
+
993
+ </div><table class="source_code">
994
+ <tr>
995
+ <td>
996
+ <pre class="lines">
997
+
998
+
999
+ 5
1000
+ 6
1001
+ 7</pre>
1002
+ </td>
1003
+ <td>
1004
+ <pre class="code"><span class="info file"># File 'lib/combos/match_maker.rb', line 5</span>
1005
+
1006
+ <span class='kw'>def</span> <span class='id identifier rubyid_vputs'>vputs</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span>
1007
+ <span class='id identifier rubyid_puts'>puts</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span> <span class='kw'>if</span> <span class='gvar'>$VERBOSE</span>
1008
+ <span class='kw'>end</span></pre>
1009
+ </td>
1010
+ </tr>
1011
+ </table>
1012
+ </div>
1013
+
1014
+ </div>
1015
+
1016
+ </div>
1017
+
1018
+ <div id="footer">
1019
+ Generated on Thu Dec 22 18:53:35 2016 by
1020
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1021
+ 0.9.5 (ruby-2.2.4).
1022
+ </div>
1023
+
1024
+ </div>
1025
+ </body>
1026
+ </html>