jg_piawe 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -3
- data/README.md +8 -1
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +835 -0
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.10.0/application.css +799 -0
- data/coverage/assets/0.10.0/application.js +1707 -0
- data/coverage/assets/0.10.0/colorbox/border.png +0 -0
- data/coverage/assets/0.10.0/colorbox/controls.png +0 -0
- data/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
- data/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.10.0/favicon_green.png +0 -0
- data/coverage/assets/0.10.0/favicon_red.png +0 -0
- data/coverage/assets/0.10.0/favicon_yellow.png +0 -0
- data/coverage/assets/0.10.0/loading.gif +0 -0
- data/coverage/assets/0.10.0/magnify.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +5270 -0
- data/doc/Piawe/FileParser.html +210 -0
- data/doc/Piawe/RuleSet.html +265 -0
- data/doc/Piawe.html +302 -0
- data/doc/created.rid +5 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +590 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +84 -0
- data/doc/js/darkfish.js +161 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +228 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +80 -0
- data/lib/piawe/rule_set.rb +4 -3
- data/lib/piawe/version.rb +1 -1
- data/lib/piawe.rb +90 -90
- metadata +77 -1
@@ -0,0 +1,210 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Piawe::FileParser - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="../js/jquery.js"></script>
|
14
|
+
<script src="../js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="class">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="../index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="class-metadata">
|
56
|
+
|
57
|
+
<div id="parent-class-section" class="nav-section">
|
58
|
+
<h3>Parent</h3>
|
59
|
+
|
60
|
+
|
61
|
+
<p class="link">Object
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<div id="method-list-section" class="nav-section">
|
69
|
+
<h3>Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list" role="directory">
|
72
|
+
|
73
|
+
<li ><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li ><a href="#method-i-report">#report</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-labelledby="class-Piawe::FileParser">
|
84
|
+
<h1 id="class-Piawe::FileParser" class="class">
|
85
|
+
class Piawe::FileParser
|
86
|
+
</h1>
|
87
|
+
|
88
|
+
<section class="description">
|
89
|
+
|
90
|
+
<p>Class to read people and rules files and convert them into a PIAWE report</p>
|
91
|
+
|
92
|
+
</section>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
108
|
+
<header>
|
109
|
+
<h3>Public Class Methods</h3>
|
110
|
+
</header>
|
111
|
+
|
112
|
+
|
113
|
+
<div id="method-c-new" class="method-detail ">
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<span class="method-name">new</span><span
|
117
|
+
class="method-args">( people_file_name, rules_file_name, report_date_string )</span>
|
118
|
+
|
119
|
+
<span class="method-click-advice">click to toggle source</span>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<div class="method-description">
|
125
|
+
|
126
|
+
<p>Create a new <a href="FileParser.html">FileParser</a> to generate a PIAWE
|
127
|
+
report from files</p>
|
128
|
+
|
129
|
+
<h4 id="method-c-new-label-Parameters">Parameters<span><a href="#method-c-new-label-Parameters">¶</a> <a href="#top">↑</a></span></h4>
|
130
|
+
<ul><li>
|
131
|
+
<p><code>people_file_name</code> - Fully qualified path of the people file</p>
|
132
|
+
</li><li>
|
133
|
+
<p><code>rules_file_name</code> - Fully qualified path of the rules file</p>
|
134
|
+
</li><li>
|
135
|
+
<p><code>report_date_string</code> - Report date to use, in YYYY/MM/DD format</p>
|
136
|
+
</li></ul>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<div class="method-source-code" id="new-source">
|
142
|
+
<pre><span class="ruby-comment"># File lib/piawe/file_parser.rb, line 13</span>
|
143
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">people_file_name</span>, <span class="ruby-identifier">rules_file_name</span>, <span class="ruby-identifier">report_date_string</span> )
|
144
|
+
<span class="ruby-ivar">@people_file_name</span> = <span class="ruby-identifier">people_file_name</span>
|
145
|
+
<span class="ruby-ivar">@rules_file_name</span> = <span class="ruby-identifier">rules_file_name</span>
|
146
|
+
<span class="ruby-ivar">@report_date_string</span> = <span class="ruby-identifier">report_date_string</span>
|
147
|
+
<span class="ruby-keyword">end</span></pre>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
</section>
|
159
|
+
|
160
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
161
|
+
<header>
|
162
|
+
<h3>Public Instance Methods</h3>
|
163
|
+
</header>
|
164
|
+
|
165
|
+
|
166
|
+
<div id="method-i-report" class="method-detail ">
|
167
|
+
|
168
|
+
<div class="method-heading">
|
169
|
+
<span class="method-name">report</span><span
|
170
|
+
class="method-args">()</span>
|
171
|
+
|
172
|
+
<span class="method-click-advice">click to toggle source</span>
|
173
|
+
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
<div class="method-description">
|
178
|
+
|
179
|
+
<p>Generate a JSON hash containing the PIAWE report</p>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<div class="method-source-code" id="report-source">
|
185
|
+
<pre><span class="ruby-comment"># File lib/piawe/file_parser.rb, line 20</span>
|
186
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">report</span>
|
187
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">pretty_generate</span>( { <span class="ruby-identifier">piawe_report</span><span class="ruby-operator">:</span> <span class="ruby-constant">Piawe</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">people_array</span>, <span class="ruby-identifier">rules_array</span> ).<span class="ruby-identifier">report</span>( <span class="ruby-identifier">report_date</span> ) } )
|
188
|
+
<span class="ruby-keyword">end</span></pre>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
</section>
|
200
|
+
|
201
|
+
</section>
|
202
|
+
</main>
|
203
|
+
|
204
|
+
|
205
|
+
<footer id="validator-badges" role="contentinfo">
|
206
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
207
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
|
208
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
209
|
+
</footer>
|
210
|
+
|
@@ -0,0 +1,265 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Piawe::RuleSet - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="../js/jquery.js"></script>
|
14
|
+
<script src="../js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="class">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="../index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="class-metadata">
|
56
|
+
|
57
|
+
<div id="parent-class-section" class="nav-section">
|
58
|
+
<h3>Parent</h3>
|
59
|
+
|
60
|
+
|
61
|
+
<p class="link">Object
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<div id="includes-section" class="nav-section">
|
66
|
+
<h3>Included Modules</h3>
|
67
|
+
|
68
|
+
<ul class="link-list">
|
69
|
+
|
70
|
+
|
71
|
+
<li><span class="include">RolePlaying::Context</span>
|
72
|
+
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
<!-- Method Quickref -->
|
79
|
+
<div id="method-list-section" class="nav-section">
|
80
|
+
<h3>Methods</h3>
|
81
|
+
|
82
|
+
<ul class="link-list" role="directory">
|
83
|
+
|
84
|
+
<li ><a href="#method-c-new">::new</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-report_line">#report_line</a>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
</nav>
|
93
|
+
|
94
|
+
<main role="main" aria-labelledby="class-Piawe::RuleSet">
|
95
|
+
<h1 id="class-Piawe::RuleSet" class="class">
|
96
|
+
class Piawe::RuleSet
|
97
|
+
</h1>
|
98
|
+
|
99
|
+
<section class="description">
|
100
|
+
|
101
|
+
<p>Class to encapsulate a set of PIAWE payment rules</p>
|
102
|
+
|
103
|
+
</section>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
119
|
+
<header>
|
120
|
+
<h3>Public Class Methods</h3>
|
121
|
+
</header>
|
122
|
+
|
123
|
+
|
124
|
+
<div id="method-c-new" class="method-detail ">
|
125
|
+
|
126
|
+
<div class="method-heading">
|
127
|
+
<span class="method-name">new</span><span
|
128
|
+
class="method-args">(rules_array)</span>
|
129
|
+
|
130
|
+
<span class="method-click-advice">click to toggle source</span>
|
131
|
+
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
<div class="method-description">
|
136
|
+
|
137
|
+
<p>Create a new <a href="RuleSet.html">RuleSet</a> to represent the rules
|
138
|
+
contained in a rules array The primary responsibiltiy of this class is to
|
139
|
+
delegate rendering of a report line to the appropriate Rule</p>
|
140
|
+
|
141
|
+
<h4 id="method-c-new-label-Parameters">Parameters<span><a href="#method-c-new-label-Parameters">¶</a> <a href="#top">↑</a></span></h4>
|
142
|
+
<ul><li>
|
143
|
+
<p><code>rules_array</code> - An array of rule hashes</p>
|
144
|
+
</li></ul>
|
145
|
+
|
146
|
+
<h4 id="method-c-new-label-Rule+Hash">Rule Hash<span><a href="#method-c-new-label-Rule+Hash">¶</a> <a href="#top">↑</a></span></h4>
|
147
|
+
|
148
|
+
<p>A rule hash it a Ruby hash that has has the following format:</p>
|
149
|
+
|
150
|
+
<pre class="ruby">{<span class="ruby-string">"rules"</span><span class="ruby-operator">:</span>[
|
151
|
+
{<span class="ruby-string">"applicableWeeks"</span><span class="ruby-operator">:</span> <span class="ruby-string">"1-26"</span>, <span class="ruby-string">"percentagePayable"</span><span class="ruby-operator">:</span> <span class="ruby-value">90</span>, <span class="ruby-string">"overtimeIncluded"</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>},
|
152
|
+
{<span class="ruby-string">"applicableWeeks"</span><span class="ruby-operator">:</span> <span class="ruby-string">"27-52"</span>, <span class="ruby-string">"percentagePayable"</span><span class="ruby-operator">:</span> <span class="ruby-value">80</span>, <span class="ruby-string">"overtimeIncluded"</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>},
|
153
|
+
{<span class="ruby-string">"applicableWeeks"</span><span class="ruby-operator">:</span> <span class="ruby-string">"53-79"</span>, <span class="ruby-string">"percentagePayable"</span><span class="ruby-operator">:</span> <span class="ruby-value">70</span>, <span class="ruby-string">"overtimeIncluded"</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>},
|
154
|
+
{<span class="ruby-string">"applicableWeeks"</span><span class="ruby-operator">:</span> <span class="ruby-string">"80-104"</span>, <span class="ruby-string">"percentagePayable"</span><span class="ruby-operator">:</span> <span class="ruby-value">60</span>, <span class="ruby-string">"overtimeIncluded"</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>},
|
155
|
+
{<span class="ruby-string">"applicableWeeks"</span><span class="ruby-operator">:</span> <span class="ruby-string">"105+"</span>, <span class="ruby-string">"percentagePayable"</span><span class="ruby-operator">:</span> <span class="ruby-value">10</span>, <span class="ruby-string">"overtimeIncluded"</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>}
|
156
|
+
]}
|
157
|
+
</pre>
|
158
|
+
<ul><li>
|
159
|
+
<p>applicableWeeks - A String that indicates the range of injury weeks during
|
160
|
+
which the rule applies - Week 1 starts at the day of the injury, and Week 2
|
161
|
+
starts on the 7th day after the injury, and so on. It can have two
|
162
|
+
formats: either a start week and end week joined by a dash, or a start week
|
163
|
+
followed by a plus sign, which indicates the rule should apply to all later
|
164
|
+
weeks as well. The first rule must have a start week of 1, the last rule
|
165
|
+
must use the plus sign syntax, and all intervening rules must have a start
|
166
|
+
week that is one greater than the end week of the preceeding rule.</p>
|
167
|
+
</li><li>
|
168
|
+
<p>percentagePayable - A Numeric that indicates the percentage of Average
|
169
|
+
Weekly Earnings that are paid when this rule applies.</p>
|
170
|
+
</li><li>
|
171
|
+
<p>overtimeIncluded - A TrueClass or FalseClass that indicates whether
|
172
|
+
overtime earnings should be considered part of Average Weekly Earnings when
|
173
|
+
this rule applies.</p>
|
174
|
+
</li></ul>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<div class="method-source-code" id="new-source">
|
180
|
+
<pre><span class="ruby-comment"># File lib/piawe/rule_set.rb, line 35</span>
|
181
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">rules_array</span>)
|
182
|
+
<span class="ruby-identifier">rules_array</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">rules_array</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"rules array is required - got #{rules_array.inspect}"</span>)
|
183
|
+
<span class="ruby-identifier">rules_array</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"rules array must contain at least one entry"</span>)
|
184
|
+
<span class="ruby-identifier">rules_array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule_hash</span><span class="ruby-operator">|</span>
|
185
|
+
<span class="ruby-identifier">add</span>(<span class="ruby-constant">Rule</span>.<span class="ruby-identifier">played_by</span> <span class="ruby-identifier">rule_hash</span>)
|
186
|
+
<span class="ruby-keyword">end</span>
|
187
|
+
<span class="ruby-identifier">rules</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">end_week</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"last rule must have a terminating + sign"</span>)
|
188
|
+
<span class="ruby-keyword">end</span></pre>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
</section>
|
200
|
+
|
201
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
202
|
+
<header>
|
203
|
+
<h3>Public Instance Methods</h3>
|
204
|
+
</header>
|
205
|
+
|
206
|
+
|
207
|
+
<div id="method-i-report_line" class="method-detail ">
|
208
|
+
|
209
|
+
<div class="method-heading">
|
210
|
+
<span class="method-name">report_line</span><span
|
211
|
+
class="method-args">(person, report_date)</span>
|
212
|
+
|
213
|
+
<span class="method-click-advice">click to toggle source</span>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
|
218
|
+
<div class="method-description">
|
219
|
+
|
220
|
+
<p>Based on the included Rules, generate a report line for a given person at a
|
221
|
+
given report date by delegating to matching Rule objects</p>
|
222
|
+
|
223
|
+
<h4 id="method-i-report_line-label-Parameters">Parameters<span><a href="#method-i-report_line-label-Parameters">¶</a> <a href="#top">↑</a></span></h4>
|
224
|
+
<ul><li>
|
225
|
+
<p><code>person</code> - The Piawe::Person for whom the report line should be
|
226
|
+
generated</p>
|
227
|
+
</li><li>
|
228
|
+
<p><code>report_date</code> - The Date for which the report line should be
|
229
|
+
generated</p>
|
230
|
+
</li></ul>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<div class="method-source-code" id="report_line-source">
|
236
|
+
<pre><span class="ruby-comment"># File lib/piawe/rule_set.rb, line 55</span>
|
237
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">report_line</span>(<span class="ruby-identifier">person</span>, <span class="ruby-identifier">report_date</span>)
|
238
|
+
<span class="ruby-identifier">rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
|
239
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">report_line</span>( <span class="ruby-identifier">person</span>, <span class="ruby-identifier">report_date</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">matches?</span>( <span class="ruby-identifier">person</span>.<span class="ruby-identifier">weeks_since_injury</span>( <span class="ruby-identifier">report_date</span> ) )
|
240
|
+
<span class="ruby-keyword">end</span> <span class="ruby-comment"># each rule</span>
|
241
|
+
<span class="ruby-comment"># this should not be possible - but putting this here defensively...</span>
|
242
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"APPLICATION BUG - A RuleSet EXISTS THAT DOES NOT COVER ALL POSSIBLE DATES!! (Date was #{report_date.strftime('%Y/%m/%d')}, person was #{person.inspect})"</span>
|
243
|
+
<span class="ruby-keyword">end</span></pre>
|
244
|
+
</div>
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
254
|
+
</section>
|
255
|
+
|
256
|
+
</section>
|
257
|
+
</main>
|
258
|
+
|
259
|
+
|
260
|
+
<footer id="validator-badges" role="contentinfo">
|
261
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
262
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
|
263
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
264
|
+
</footer>
|
265
|
+
|