physh_roller 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +7 -0
  3. data/README +1 -0
  4. data/bin/dice +42 -0
  5. data/doc/Object.html +204 -0
  6. data/doc/Output.html +226 -0
  7. data/doc/PhyshRoller.html +140 -0
  8. data/doc/PhyshRoller/DiceRoll.html +498 -0
  9. data/doc/PhyshRoller/Die.html +266 -0
  10. data/doc/created.rid +14 -0
  11. data/doc/doc/created_rid.html +97 -0
  12. data/doc/features/physh_roller/parse_dice_roll_string_feature.html +117 -0
  13. data/doc/features/physh_roller/roll_dice_feature.html +119 -0
  14. data/doc/features/physh_roller/roll_die_feature.html +117 -0
  15. data/doc/images/add.png +0 -0
  16. data/doc/images/arrow_up.png +0 -0
  17. data/doc/images/brick.png +0 -0
  18. data/doc/images/brick_link.png +0 -0
  19. data/doc/images/bug.png +0 -0
  20. data/doc/images/bullet_black.png +0 -0
  21. data/doc/images/bullet_toggle_minus.png +0 -0
  22. data/doc/images/bullet_toggle_plus.png +0 -0
  23. data/doc/images/date.png +0 -0
  24. data/doc/images/delete.png +0 -0
  25. data/doc/images/find.png +0 -0
  26. data/doc/images/loadingAnimation.gif +0 -0
  27. data/doc/images/macFFBgHack.png +0 -0
  28. data/doc/images/package.png +0 -0
  29. data/doc/images/page_green.png +0 -0
  30. data/doc/images/page_white_text.png +0 -0
  31. data/doc/images/page_white_width.png +0 -0
  32. data/doc/images/plugin.png +0 -0
  33. data/doc/images/ruby.png +0 -0
  34. data/doc/images/tag_blue.png +0 -0
  35. data/doc/images/tag_green.png +0 -0
  36. data/doc/images/transparent.png +0 -0
  37. data/doc/images/wrench.png +0 -0
  38. data/doc/images/wrench_orange.png +0 -0
  39. data/doc/images/zoom.png +0 -0
  40. data/doc/index.html +94 -0
  41. data/doc/js/darkfish.js +155 -0
  42. data/doc/js/jquery.js +18 -0
  43. data/doc/js/navigation.js +142 -0
  44. data/doc/js/search.js +94 -0
  45. data/doc/js/search_index.js +1 -0
  46. data/doc/js/searcher.js +228 -0
  47. data/doc/rdoc.css +595 -0
  48. data/doc/table_of_contents.html +98 -0
  49. data/features/physh_roller/parse_dice_roll_string.feature +19 -0
  50. data/features/physh_roller/roll_dice.feature +22 -0
  51. data/features/physh_roller/roll_die.feature +19 -0
  52. data/features/step_definitions/physh_roller/physh_roller_steps.rb +79 -0
  53. data/features/support/env.rb +3 -0
  54. data/lib/physh_roller.rb +2 -0
  55. data/lib/physh_roller/dice_roll.rb +62 -0
  56. data/lib/physh_roller/die.rb +14 -0
  57. data/spec/physh_roller/dice_roll_spec.rb +145 -0
  58. data/spec/physh_roller/die_spec.rb +44 -0
  59. data/spec/spec_helper.rb +3 -0
  60. metadata +133 -0
@@ -0,0 +1,140 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module PhyshRoller - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>features/step_definitions/physh_roller/physh_roller_steps.rb
53
+ <li>lib/physh_roller/dice_roll.rb
54
+ <li>lib/physh_roller/die.rb
55
+ <li>spec/physh_roller/dice_roll_spec.rb
56
+ <li>spec/physh_roller/die_spec.rb
57
+ </ul>
58
+ </nav>
59
+
60
+
61
+ </div>
62
+
63
+ <div id="class-metadata">
64
+
65
+
66
+
67
+
68
+
69
+ </div>
70
+
71
+ <div id="project-metadata">
72
+ <nav id="fileindex-section" class="section project-section">
73
+ <h3 class="section-header">Pages</h3>
74
+
75
+ <ul>
76
+
77
+ <li class="file"><a href="./doc/created_rid.html">created.rid</a>
78
+
79
+ <li class="file"><a href="./features/physh_roller/parse_dice_roll_string_feature.html">parse_dice_roll_string.feature</a>
80
+
81
+ <li class="file"><a href="./features/physh_roller/roll_dice_feature.html">roll_dice.feature</a>
82
+
83
+ <li class="file"><a href="./features/physh_roller/roll_die_feature.html">roll_die.feature</a>
84
+
85
+ </ul>
86
+ </nav>
87
+
88
+ <nav id="classindex-section" class="section project-section">
89
+ <h3 class="section-header">Class and Module Index</h3>
90
+
91
+ <ul class="link-list">
92
+
93
+ <li><a href="./Object.html">Object</a>
94
+
95
+ <li><a href="./Output.html">Output</a>
96
+
97
+ <li><a href="./PhyshRoller.html">PhyshRoller</a>
98
+
99
+ <li><a href="./PhyshRoller/DiceRoll.html">PhyshRoller::DiceRoll</a>
100
+
101
+ <li><a href="./PhyshRoller/Die.html">PhyshRoller::Die</a>
102
+
103
+ </ul>
104
+ </nav>
105
+
106
+ </div>
107
+ </nav>
108
+
109
+ <div id="documentation">
110
+ <h1 class="module">module PhyshRoller</h1>
111
+
112
+ <div id="description" class="description">
113
+
114
+ </div><!-- description -->
115
+
116
+
117
+
118
+
119
+ <section id="5Buntitled-5D" class="documentation-section">
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <!-- Methods -->
129
+
130
+ </section><!-- 5Buntitled-5D -->
131
+
132
+ </div><!-- documentation -->
133
+
134
+
135
+ <footer id="validator-badges">
136
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
137
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
138
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
139
+ </footer>
140
+
@@ -0,0 +1,498 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class PhyshRoller::DiceRoll - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/physh_roller/dice_roll.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+ <nav id="parent-class-section" class="section">
62
+ <h3 class="section-header">Parent</h3>
63
+
64
+ <p class="link"><a href="../Object.html">Object</a>
65
+
66
+ </nav>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <nav id="method-list-section" class="section">
72
+ <h3 class="section-header">Methods</h3>
73
+
74
+ <ul class="link-list">
75
+
76
+ <li ><a href="#method-c-new">::new</a>
77
+
78
+ <li ><a href="#method-i-add_dice_to_dice_array">#add_dice_to_dice_array</a>
79
+
80
+ <li ><a href="#method-i-number_of_dice">#number_of_dice</a>
81
+
82
+ <li ><a href="#method-i-results">#results</a>
83
+
84
+ <li ><a href="#method-i-roll_dice">#roll_dice</a>
85
+
86
+ <li ><a href="#method-i-set_default_values">#set_default_values</a>
87
+
88
+ <li ><a href="#method-i-valid_dice_roll_string-3F">#valid_dice_roll_string?</a>
89
+
90
+ </ul>
91
+ </nav>
92
+
93
+ </div>
94
+
95
+ <div id="project-metadata">
96
+ <nav id="fileindex-section" class="section project-section">
97
+ <h3 class="section-header">Pages</h3>
98
+
99
+ <ul>
100
+
101
+ <li class="file"><a href="../doc/created_rid.html">created.rid</a>
102
+
103
+ <li class="file"><a href="../features/physh_roller/parse_dice_roll_string_feature.html">parse_dice_roll_string.feature</a>
104
+
105
+ <li class="file"><a href="../features/physh_roller/roll_dice_feature.html">roll_dice.feature</a>
106
+
107
+ <li class="file"><a href="../features/physh_roller/roll_die_feature.html">roll_die.feature</a>
108
+
109
+ </ul>
110
+ </nav>
111
+
112
+ <nav id="classindex-section" class="section project-section">
113
+ <h3 class="section-header">Class and Module Index</h3>
114
+
115
+ <ul class="link-list">
116
+
117
+ <li><a href="../Object.html">Object</a>
118
+
119
+ <li><a href="../Output.html">Output</a>
120
+
121
+ <li><a href="../PhyshRoller.html">PhyshRoller</a>
122
+
123
+ <li><a href="../PhyshRoller/DiceRoll.html">PhyshRoller::DiceRoll</a>
124
+
125
+ <li><a href="../PhyshRoller/Die.html">PhyshRoller::Die</a>
126
+
127
+ </ul>
128
+ </nav>
129
+
130
+ </div>
131
+ </nav>
132
+
133
+ <div id="documentation">
134
+ <h1 class="class">class PhyshRoller::DiceRoll</h1>
135
+
136
+ <div id="description" class="description">
137
+
138
+ </div><!-- description -->
139
+
140
+
141
+
142
+
143
+ <section id="5Buntitled-5D" class="documentation-section">
144
+
145
+
146
+
147
+
148
+
149
+ <!-- Constants -->
150
+ <section id="constants-list" class="section">
151
+ <h3 class="section-header">Constants</h3>
152
+ <dl>
153
+
154
+ <dt id="DICE_ROLL_REGEXP">DICE_ROLL_REGEXP
155
+
156
+ <dd class="description">
157
+
158
+
159
+ </dl>
160
+ </section>
161
+
162
+
163
+
164
+ <!-- Attributes -->
165
+ <section id="attribute-method-details" class="method-section section">
166
+ <h3 class="section-header">Attributes</h3>
167
+
168
+
169
+ <div id="attribute-i-dice_array" class="method-detail">
170
+ <div class="method-heading attribute-method-heading">
171
+ <span class="method-name">dice_array</span><span
172
+ class="attribute-access-type">[R]</span>
173
+ </div>
174
+
175
+ <div class="method-description">
176
+
177
+
178
+
179
+ </div>
180
+ </div>
181
+
182
+ <div id="attribute-i-dice_roll_string" class="method-detail">
183
+ <div class="method-heading attribute-method-heading">
184
+ <span class="method-name">dice_roll_string</span><span
185
+ class="attribute-access-type">[R]</span>
186
+ </div>
187
+
188
+ <div class="method-description">
189
+
190
+
191
+
192
+ </div>
193
+ </div>
194
+
195
+ <div id="attribute-i-roll_modifier" class="method-detail">
196
+ <div class="method-heading attribute-method-heading">
197
+ <span class="method-name">roll_modifier</span><span
198
+ class="attribute-access-type">[R]</span>
199
+ </div>
200
+
201
+ <div class="method-description">
202
+
203
+
204
+
205
+ </div>
206
+ </div>
207
+
208
+ <div id="attribute-i-sides_on_dice" class="method-detail">
209
+ <div class="method-heading attribute-method-heading">
210
+ <span class="method-name">sides_on_dice</span><span
211
+ class="attribute-access-type">[R]</span>
212
+ </div>
213
+
214
+ <div class="method-description">
215
+
216
+
217
+
218
+ </div>
219
+ </div>
220
+
221
+ </section><!-- attribute-method-details -->
222
+
223
+
224
+ <!-- Methods -->
225
+
226
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
227
+ <h3 class="section-header">Public Class Methods</h3>
228
+
229
+
230
+ <div id="method-c-new" class="method-detail ">
231
+
232
+ <div class="method-heading">
233
+ <span class="method-name">new</span><span
234
+ class="method-args">(dice_roll_string, output)</span>
235
+
236
+ <span class="method-click-advice">click to toggle source</span>
237
+
238
+ </div>
239
+
240
+
241
+ <div class="method-description">
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <div class="method-source-code" id="new-source">
249
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 8</span>
250
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">dice_roll_string</span>, <span class="ruby-identifier">output</span>)
251
+ <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
252
+ <span class="ruby-ivar">@dice_roll_string</span> = <span class="ruby-identifier">dice_roll_string</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39; &#39;</span>, <span class="ruby-string">&#39;&#39;</span>)
253
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">valid_dice_roll_string?</span>
254
+ <span class="ruby-identifier">set_default_values</span>
255
+ <span class="ruby-identifier">add_dice_to_dice_array</span>(<span class="ruby-ivar">@number_of_dice</span>, <span class="ruby-ivar">@sides_on_dice</span>)
256
+ <span class="ruby-keyword">else</span>
257
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Invalid dice roll string.&#39;</span>)
258
+ <span class="ruby-keyword">end</span>
259
+ <span class="ruby-keyword">end</span></pre>
260
+ </div><!-- new-source -->
261
+
262
+ </div>
263
+
264
+
265
+
266
+
267
+ </div><!-- new-method -->
268
+
269
+
270
+ </section><!-- public-class-method-details -->
271
+
272
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
273
+ <h3 class="section-header">Public Instance Methods</h3>
274
+
275
+
276
+ <div id="method-i-add_dice_to_dice_array" class="method-detail ">
277
+
278
+ <div class="method-heading">
279
+ <span class="method-name">add_dice_to_dice_array</span><span
280
+ class="method-args">(number_of_dice, sides_on_dice)</span>
281
+
282
+ <span class="method-click-advice">click to toggle source</span>
283
+
284
+ </div>
285
+
286
+
287
+ <div class="method-description">
288
+
289
+
290
+
291
+
292
+
293
+
294
+ <div class="method-source-code" id="add_dice_to_dice_array-source">
295
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 35</span>
296
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">add_dice_to_dice_array</span>(<span class="ruby-identifier">number_of_dice</span>, <span class="ruby-identifier">sides_on_dice</span>)
297
+ <span class="ruby-identifier">number_of_dice</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span>
298
+ <span class="ruby-identifier">die</span> = <span class="ruby-constant">Die</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sides_on_dice</span>)
299
+ <span class="ruby-ivar">@dice_array</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">die</span>
300
+ <span class="ruby-keyword">end</span>
301
+ <span class="ruby-keyword">end</span></pre>
302
+ </div><!-- add_dice_to_dice_array-source -->
303
+
304
+ </div>
305
+
306
+
307
+
308
+
309
+ </div><!-- add_dice_to_dice_array-method -->
310
+
311
+
312
+ <div id="method-i-number_of_dice" class="method-detail ">
313
+
314
+ <div class="method-heading">
315
+ <span class="method-name">number_of_dice</span><span
316
+ class="method-args">()</span>
317
+
318
+ <span class="method-click-advice">click to toggle source</span>
319
+
320
+ </div>
321
+
322
+
323
+ <div class="method-description">
324
+
325
+
326
+
327
+
328
+
329
+
330
+ <div class="method-source-code" id="number_of_dice-source">
331
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 42</span>
332
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">number_of_dice</span>
333
+ <span class="ruby-ivar">@dice_array</span>.<span class="ruby-identifier">size</span>
334
+ <span class="ruby-keyword">end</span></pre>
335
+ </div><!-- number_of_dice-source -->
336
+
337
+ </div>
338
+
339
+
340
+
341
+
342
+ </div><!-- number_of_dice-method -->
343
+
344
+
345
+ <div id="method-i-results" class="method-detail ">
346
+
347
+ <div class="method-heading">
348
+ <span class="method-name">results</span><span
349
+ class="method-args">()</span>
350
+
351
+ <span class="method-click-advice">click to toggle source</span>
352
+
353
+ </div>
354
+
355
+
356
+ <div class="method-description">
357
+
358
+
359
+
360
+
361
+
362
+
363
+ <div class="method-source-code" id="results-source">
364
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 46</span>
365
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">results</span>
366
+ <span class="ruby-identifier">results_hash</span> = {
367
+ <span class="ruby-value">:dice_roll</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@dice_roll_string</span>,
368
+ <span class="ruby-value">:dice_rolls</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@dice_array</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">die</span><span class="ruby-operator">|</span> <span class="ruby-identifier">die</span>.<span class="ruby-identifier">last_result</span> }.<span class="ruby-identifier">sort</span>,
369
+ <span class="ruby-value">:roll_modifier</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@roll_modifier</span>,
370
+ <span class="ruby-value">:sum</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-ivar">@dice_array</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">die</span><span class="ruby-operator">|</span> <span class="ruby-identifier">die</span>.<span class="ruby-identifier">last_result</span> }.<span class="ruby-identifier">reduce</span>(<span class="ruby-value">:+</span>) <span class="ruby-operator">+</span> <span class="ruby-ivar">@roll_modifier</span>)
371
+ }
372
+ <span class="ruby-keyword">end</span></pre>
373
+ </div><!-- results-source -->
374
+
375
+ </div>
376
+
377
+
378
+
379
+
380
+ </div><!-- results-method -->
381
+
382
+
383
+ <div id="method-i-roll_dice" class="method-detail ">
384
+
385
+ <div class="method-heading">
386
+ <span class="method-name">roll_dice</span><span
387
+ class="method-args">()</span>
388
+
389
+ <span class="method-click-advice">click to toggle source</span>
390
+
391
+ </div>
392
+
393
+
394
+ <div class="method-description">
395
+
396
+
397
+
398
+
399
+
400
+
401
+ <div class="method-source-code" id="roll_dice-source">
402
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 31</span>
403
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">roll_dice</span>
404
+ <span class="ruby-ivar">@dice_array</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">die</span><span class="ruby-operator">|</span> <span class="ruby-identifier">die</span>.<span class="ruby-identifier">roll</span> }
405
+ <span class="ruby-keyword">end</span></pre>
406
+ </div><!-- roll_dice-source -->
407
+
408
+ </div>
409
+
410
+
411
+
412
+
413
+ </div><!-- roll_dice-method -->
414
+
415
+
416
+ <div id="method-i-set_default_values" class="method-detail ">
417
+
418
+ <div class="method-heading">
419
+ <span class="method-name">set_default_values</span><span
420
+ class="method-args">()</span>
421
+
422
+ <span class="method-click-advice">click to toggle source</span>
423
+
424
+ </div>
425
+
426
+
427
+ <div class="method-description">
428
+
429
+
430
+
431
+
432
+
433
+
434
+ <div class="method-source-code" id="set_default_values-source">
435
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 23</span>
436
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">set_default_values</span>
437
+ <span class="ruby-ivar">@number_of_dice</span>, <span class="ruby-ivar">@sides_on_dice</span>, <span class="ruby-ivar">@roll_modifier</span> =
438
+ <span class="ruby-constant">DICE_ROLL_REGEXP</span>.<span class="ruby-identifier">match</span>(<span class="ruby-ivar">@dice_roll_string</span>).<span class="ruby-identifier">captures</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">capture</span><span class="ruby-operator">|</span> <span class="ruby-identifier">capture</span>.<span class="ruby-identifier">to_i</span> }
439
+ <span class="ruby-ivar">@number_of_dice</span> = <span class="ruby-value">1</span> <span class="ruby-keyword">unless</span> (<span class="ruby-ivar">@number_of_dice</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
440
+ <span class="ruby-ivar">@roll_modifier</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
441
+ <span class="ruby-ivar">@dice_array</span> = []
442
+ <span class="ruby-keyword">end</span></pre>
443
+ </div><!-- set_default_values-source -->
444
+
445
+ </div>
446
+
447
+
448
+
449
+
450
+ </div><!-- set_default_values-method -->
451
+
452
+
453
+ <div id="method-i-valid_dice_roll_string-3F" class="method-detail ">
454
+
455
+ <div class="method-heading">
456
+ <span class="method-name">valid_dice_roll_string?</span><span
457
+ class="method-args">()</span>
458
+
459
+ <span class="method-click-advice">click to toggle source</span>
460
+
461
+ </div>
462
+
463
+
464
+ <div class="method-description">
465
+
466
+
467
+
468
+
469
+
470
+
471
+ <div class="method-source-code" id="valid_dice_roll_string-3F-source">
472
+ <pre><span class="ruby-comment"># File lib/physh_roller/dice_roll.rb, line 19</span>
473
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">valid_dice_roll_string?</span>
474
+ <span class="ruby-operator">!</span><span class="ruby-operator">!</span>(<span class="ruby-ivar">@dice_roll_string</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">DICE_ROLL_REGEXP</span>)
475
+ <span class="ruby-keyword">end</span></pre>
476
+ </div><!-- valid_dice_roll_string-3F-source -->
477
+
478
+ </div>
479
+
480
+
481
+
482
+
483
+ </div><!-- valid_dice_roll_string-3F-method -->
484
+
485
+
486
+ </section><!-- public-instance-method-details -->
487
+
488
+ </section><!-- 5Buntitled-5D -->
489
+
490
+ </div><!-- documentation -->
491
+
492
+
493
+ <footer id="validator-badges">
494
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
495
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
496
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
497
+ </footer>
498
+