game_shuffle_cards 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +10 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +123 -0
  6. data/Rakefile +2 -0
  7. data/doc/GameShuffleCards/Card.html +622 -0
  8. data/doc/GameShuffleCards/Game.html +1094 -0
  9. data/doc/GameShuffleCards/NotEnoughCardsPerPlayersError.html +123 -0
  10. data/doc/GameShuffleCards/NotEnoughPlayersError.html +123 -0
  11. data/doc/GameShuffleCards/ToManyCardsPerPlayerError.html +123 -0
  12. data/doc/GameShuffleCards/ToManyPlayersError.html +123 -0
  13. data/doc/GameShuffleCards/TooManyCardsDemandedError.html +123 -0
  14. data/doc/GameShuffleCards/ValidateGame.html +438 -0
  15. data/doc/GameShuffleCards.html +129 -0
  16. data/doc/_index.html +198 -0
  17. data/doc/class_list.html +58 -0
  18. data/doc/css/common.css +1 -0
  19. data/doc/css/full_list.css +57 -0
  20. data/doc/css/style.css +339 -0
  21. data/doc/file.README.html +196 -0
  22. data/doc/file_list.html +60 -0
  23. data/doc/frames.html +26 -0
  24. data/doc/index.html +196 -0
  25. data/doc/js/app.js +219 -0
  26. data/doc/js/full_list.js +181 -0
  27. data/doc/js/jquery.js +4 -0
  28. data/doc/method_list.html +159 -0
  29. data/doc/top-level-namespace.html +131 -0
  30. data/features/deck_of_cards.feature +58 -0
  31. data/features/initial_settings.feature +76 -0
  32. data/features/step_definitions/deck_of_cards_step.rb +21 -0
  33. data/features/step_definitions/initial_settings_step.rb +44 -0
  34. data/features/step_definitions/step.rb +2 -0
  35. data/game_shuffle_cards.gemspec +24 -0
  36. data/lib/game_shuffle_cards/card.rb +26 -0
  37. data/lib/game_shuffle_cards/exceptions.rb +9 -0
  38. data/lib/game_shuffle_cards/game.rb +84 -0
  39. data/lib/game_shuffle_cards/validate_game.rb +43 -0
  40. data/lib/game_shuffle_cards/version.rb +5 -0
  41. data/lib/game_shuffle_cards.rb +2 -0
  42. metadata +119 -0
@@ -0,0 +1,438 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: GameShuffleCards::ValidateGame
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
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
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!GameShuffleCards/ValidateGame.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (V)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../GameShuffleCards.html" title="GameShuffleCards (module)">GameShuffleCards</a></span></span>
36
+ &raquo;
37
+ <span class="title">ValidateGame</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: GameShuffleCards::ValidateGame
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">GameShuffleCards::ValidateGame</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/game_shuffle_cards/validate_game.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>validation to secure the inputs of the Game</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+ <p class="tag_title">Author:</p>
113
+ <ul class="author">
114
+
115
+ <li>
116
+
117
+
118
+
119
+
120
+
121
+ <div class='inline'>
122
+ <p>Diego Hernán Piccinini Lagos</p>
123
+ </div>
124
+
125
+ </li>
126
+
127
+ </ul>
128
+
129
+ </div>
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <h2>
138
+ Class Method Summary
139
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
140
+ </h2>
141
+
142
+ <ul class="summary">
143
+
144
+ <li class="public ">
145
+ <span class="summary_signature">
146
+
147
+ <a href="#parse_and_validate-class_method" title="parse_and_validate (class method)">+ (Object) <strong>parse_and_validate</strong>(players, cards_per_player) </a>
148
+
149
+
150
+
151
+ </span>
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <span class="summary_desc"><div class='inline'>
162
+ <p>Given two values String or Integer, checks whether they are valid in a
163
+ context Game then return the integers values or raise an exception.</p>
164
+ </div></span>
165
+
166
+ </li>
167
+
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#parse_and_validate_players-class_method" title="parse_and_validate_players (class method)">+ (Object) <strong>parse_and_validate_players</strong>(players) </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'>
187
+ <p>Validates whether the amount and type of players are right.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ </ul>
194
+
195
+
196
+
197
+
198
+ <div id="class_method_details" class="method_details_list">
199
+ <h2>Class Method Details</h2>
200
+
201
+
202
+ <div class="method_details first">
203
+ <h3 class="signature first" id="parse_and_validate-class_method">
204
+
205
+ + (<tt>Object</tt>) <strong>parse_and_validate</strong>(players, cards_per_player)
206
+
207
+
208
+
209
+
210
+
211
+ </h3><div class="docstring">
212
+ <div class="discussion">
213
+
214
+ <p>Given two values String or Integer, checks whether they are valid in a
215
+ context Game then return the integers values or raise an exception</p>
216
+
217
+
218
+ </div>
219
+ </div>
220
+ <div class="tags">
221
+ <p class="tag_title">Parameters:</p>
222
+ <ul class="param">
223
+
224
+ <li>
225
+
226
+ <span class='name'>players</span>
227
+
228
+
229
+ <span class='type'>(<tt>String|Integer</tt>)</span>
230
+
231
+
232
+
233
+ </li>
234
+
235
+ <li>
236
+
237
+ <span class='name'>cards_per_player</span>
238
+
239
+
240
+ <span class='type'>(<tt>String|Integer</tt>)</span>
241
+
242
+
243
+
244
+ </li>
245
+
246
+ </ul>
247
+
248
+ <p class="tag_title">Returns:</p>
249
+ <ul class="return">
250
+
251
+ <li>
252
+
253
+
254
+ <span class='type'></span>
255
+
256
+
257
+
258
+
259
+ <div class='inline'>
260
+ <p>players and cards per player [Array] with integers values of each one</p>
261
+ </div>
262
+
263
+ </li>
264
+
265
+ </ul>
266
+ <p class="tag_title">Raises:</p>
267
+ <ul class="raise">
268
+
269
+ <li>
270
+
271
+
272
+ <span class='type'>(<tt><span class='object_link'><a href="ToManyPlayersError.html" title="GameShuffleCards::ToManyPlayersError (class)">GameShuffleCards::ToManyPlayersError</a></span></tt>)</span>
273
+
274
+
275
+
276
+ </li>
277
+
278
+ </ul>
279
+
280
+ </div><table class="source_code">
281
+ <tr>
282
+ <td>
283
+ <pre class="lines">
284
+
285
+
286
+ 12
287
+ 13
288
+ 14
289
+ 15
290
+ 16
291
+ 17
292
+ 18
293
+ 19
294
+ 20
295
+ 21
296
+ 22
297
+ 23
298
+ 24
299
+ 25
300
+ 26</pre>
301
+ </td>
302
+ <td>
303
+ <pre class="code"><span class="info file"># File 'lib/game_shuffle_cards/validate_game.rb', line 12</span>
304
+
305
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_and_validate'>parse_and_validate</span><span class='lparen'>(</span><span class='id identifier rubyid_players'>players</span><span class='comma'>,</span> <span class='id identifier rubyid_cards_per_player'>cards_per_player</span><span class='rparen'>)</span>
306
+ <span class='kw'>begin</span>
307
+ <span class='id identifier rubyid_players'>players</span> <span class='op'>=</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_players'>players</span><span class='rparen'>)</span>
308
+ <span class='id identifier rubyid_cards_per_player'>cards_per_player</span><span class='op'>=</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_cards_per_player'>cards_per_player</span><span class='rparen'>)</span>
309
+
310
+ <span class='kw'>rescue</span>
311
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span>
312
+ <span class='kw'>end</span>
313
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>ToManyPlayersError</span> <span class='kw'>if</span> <span class='id identifier rubyid_players'>players</span> <span class='op'>&gt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>MAXIMUN_PLAYERS</span>
314
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>NotEnoughPlayersError</span> <span class='kw'>if</span> <span class='id identifier rubyid_players'>players</span> <span class='op'>&lt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>MINIMUN_PLAYERS</span>
315
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>ToManyCardsPerPlayerError</span> <span class='kw'>if</span> <span class='id identifier rubyid_cards_per_player'>cards_per_player</span> <span class='op'>&gt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>TOTAL_CARDS</span>
316
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>NotEnoughCardsPerPlayersError</span> <span class='kw'>if</span> <span class='id identifier rubyid_cards_per_player'>cards_per_player</span> <span class='op'>&lt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>MINIMUN_CARDS</span>
317
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>TooManyCardsDemandedError</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_players'>players</span> <span class='op'>*</span> <span class='id identifier rubyid_cards_per_player'>cards_per_player</span><span class='rparen'>)</span> <span class='op'>&gt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>TOTAL_CARDS</span>
318
+ <span class='lbracket'>[</span><span class='id identifier rubyid_players'>players</span><span class='comma'>,</span><span class='id identifier rubyid_cards_per_player'>cards_per_player</span><span class='rbracket'>]</span>
319
+ <span class='kw'>end</span></pre>
320
+ </td>
321
+ </tr>
322
+ </table>
323
+ </div>
324
+
325
+ <div class="method_details ">
326
+ <h3 class="signature " id="parse_and_validate_players-class_method">
327
+
328
+ + (<tt>Object</tt>) <strong>parse_and_validate_players</strong>(players)
329
+
330
+
331
+
332
+
333
+
334
+ </h3><div class="docstring">
335
+ <div class="discussion">
336
+
337
+ <p>Validates whether the amount and type of players are right. Otherwise raise
338
+ an exception</p>
339
+
340
+
341
+ </div>
342
+ </div>
343
+ <div class="tags">
344
+ <p class="tag_title">Parameters:</p>
345
+ <ul class="param">
346
+
347
+ <li>
348
+
349
+ <span class='name'>players</span>
350
+
351
+
352
+ <span class='type'>(<tt>String|Integer</tt>)</span>
353
+
354
+
355
+
356
+ </li>
357
+
358
+ </ul>
359
+
360
+ <p class="tag_title">Returns:</p>
361
+ <ul class="return">
362
+
363
+ <li>
364
+
365
+
366
+ <span class='type'></span>
367
+
368
+
369
+
370
+
371
+ <div class='inline'>
372
+ <p>number of players [Integer]</p>
373
+ </div>
374
+
375
+ </li>
376
+
377
+ </ul>
378
+ <p class="tag_title">Raises:</p>
379
+ <ul class="raise">
380
+
381
+ <li>
382
+
383
+
384
+ <span class='type'>(<tt><span class='object_link'><a href="ToManyPlayersError.html" title="GameShuffleCards::ToManyPlayersError (class)">GameShuffleCards::ToManyPlayersError</a></span></tt>)</span>
385
+
386
+
387
+
388
+ </li>
389
+
390
+ </ul>
391
+
392
+ </div><table class="source_code">
393
+ <tr>
394
+ <td>
395
+ <pre class="lines">
396
+
397
+
398
+ 31
399
+ 32
400
+ 33
401
+ 34
402
+ 35
403
+ 36
404
+ 37
405
+ 38
406
+ 39
407
+ 40</pre>
408
+ </td>
409
+ <td>
410
+ <pre class="code"><span class="info file"># File 'lib/game_shuffle_cards/validate_game.rb', line 31</span>
411
+
412
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_and_validate_players'>parse_and_validate_players</span><span class='lparen'>(</span><span class='id identifier rubyid_players'>players</span><span class='rparen'>)</span>
413
+ <span class='kw'>begin</span>
414
+ <span class='id identifier rubyid_players'>players</span> <span class='op'>=</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_players'>players</span><span class='rparen'>)</span>
415
+ <span class='kw'>rescue</span>
416
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span>
417
+ <span class='kw'>end</span>
418
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>ToManyPlayersError</span> <span class='kw'>if</span> <span class='id identifier rubyid_players'>players</span> <span class='op'>&gt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>MAXIMUN_PLAYERS</span>
419
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>NotEnoughPlayersError</span> <span class='kw'>if</span> <span class='id identifier rubyid_players'>players</span> <span class='op'>&lt;</span> <span class='const'>GameShuffleCards</span><span class='op'>::</span><span class='const'>Game</span><span class='op'>::</span><span class='const'>MINIMUN_PLAYERS</span>
420
+ <span class='id identifier rubyid_players'>players</span>
421
+ <span class='kw'>end</span></pre>
422
+ </td>
423
+ </tr>
424
+ </table>
425
+ </div>
426
+
427
+ </div>
428
+
429
+ </div>
430
+
431
+ <div id="footer">
432
+ Generated on Thu Apr 2 16:38:00 2015 by
433
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
434
+ 0.8.7.6 (ruby-2.2.0).
435
+ </div>
436
+
437
+ </body>
438
+ </html>
@@ -0,0 +1,129 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: GameShuffleCards
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
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
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!GameShuffleCards.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (G)</a> &raquo;
35
+
36
+
37
+ <span class="title">GameShuffleCards</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: GameShuffleCards
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/game_shuffle_cards/card.rb<span class="defines">,<br />
83
+ lib/game_shuffle_cards/game.rb,<br /> lib/game_shuffle_cards/version.rb,<br /> lib/game_shuffle_cards/exceptions.rb,<br /> lib/game_shuffle_cards/validate_game.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Defined Under Namespace</h2>
90
+ <p class="children">
91
+
92
+
93
+
94
+
95
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="GameShuffleCards/Card.html" title="GameShuffleCards::Card (class)">Card</a></span>, <span class='object_link'><a href="GameShuffleCards/Game.html" title="GameShuffleCards::Game (class)">Game</a></span>, <span class='object_link'><a href="GameShuffleCards/NotEnoughCardsPerPlayersError.html" title="GameShuffleCards::NotEnoughCardsPerPlayersError (class)">NotEnoughCardsPerPlayersError</a></span>, <span class='object_link'><a href="GameShuffleCards/NotEnoughPlayersError.html" title="GameShuffleCards::NotEnoughPlayersError (class)">NotEnoughPlayersError</a></span>, <span class='object_link'><a href="GameShuffleCards/ToManyCardsPerPlayerError.html" title="GameShuffleCards::ToManyCardsPerPlayerError (class)">ToManyCardsPerPlayerError</a></span>, <span class='object_link'><a href="GameShuffleCards/ToManyPlayersError.html" title="GameShuffleCards::ToManyPlayersError (class)">ToManyPlayersError</a></span>, <span class='object_link'><a href="GameShuffleCards/TooManyCardsDemandedError.html" title="GameShuffleCards::TooManyCardsDemandedError (class)">TooManyCardsDemandedError</a></span>, <span class='object_link'><a href="GameShuffleCards/ValidateGame.html" title="GameShuffleCards::ValidateGame (class)">ValidateGame</a></span>
96
+
97
+
98
+ </p>
99
+
100
+ <h2>Constant Summary</h2>
101
+
102
+ <dl class="constants">
103
+
104
+ <dt id="VERSION-constant" class="">VERSION =
105
+
106
+ </dt>
107
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1.0.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
108
+
109
+ </dl>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ </div>
121
+
122
+ <div id="footer">
123
+ Generated on Thu Apr 2 16:38:00 2015 by
124
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
125
+ 0.8.7.6 (ruby-2.2.0).
126
+ </div>
127
+
128
+ </body>
129
+ </html>