LPP_alu0100966589 0.1.1
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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +20 -0
- data/Rakefile +6 -0
- data/TDD.gemspec +41 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Array.html +355 -0
- data/docs/CarbohydrateRich.html +152 -0
- data/docs/Dll.html +845 -0
- data/docs/DllNode.html +418 -0
- data/docs/EggMilkAndDerivatives.html +152 -0
- data/docs/Fish.html +152 -0
- data/docs/Food.html +1500 -0
- data/docs/Fruits.html +152 -0
- data/docs/MeatAndDerivatives.html +152 -0
- data/docs/OilsAndSweets.html +152 -0
- data/docs/TDD.html +117 -0
- data/docs/Vegetables.html +152 -0
- data/docs/_index.html +229 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +499 -0
- data/docs/file.README.html +109 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +109 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +251 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/TDD.rb +12 -0
- data/lib/TDD/Dll.rb +80 -0
- data/lib/TDD/DllNode.rb +3 -0
- data/lib/TDD/Food.rb +110 -0
- data/lib/TDD/FoodPyramidClasses.rb +20 -0
- data/lib/TDD/Plate.rb +124 -0
- data/lib/TDD/sort.rb +35 -0
- data/lib/TDD/version.rb +3 -0
- metadata +203 -0
data/docs/Fish.html
ADDED
@@ -0,0 +1,152 @@
|
|
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
|
+
Class: Fish
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.12
|
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 = "Fish";
|
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?1"></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 (F)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Fish</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
|
+
<div id="content"><h1>Class: Fish
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="Food.html" title="Food (class)">Food</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="Food.html" title="Food (class)">Food</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">Fish</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/TDD/FoodPyramidClasses.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<h2>Constant Summary</h2>
|
108
|
+
|
109
|
+
<h3 class="inherited">Constants inherited
|
110
|
+
from <span class='object_link'><a href="Food.html" title="Food (class)">Food</a></span></h3>
|
111
|
+
<p class="inherited"><span class='object_link'><a href="Food.html#DELTA_TIME-constant" title="Food::DELTA_TIME (constant)">Food::DELTA_TIME</a></span></p>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<h2>Instance Attribute Summary</h2>
|
117
|
+
|
118
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Food.html" title="Food (class)">Food</a></span></h3>
|
119
|
+
<p class="inherited"><span class='object_link'><a href="Food.html#energetic_value-instance_method" title="Food#energetic_value (method)">#energetic_value</a></span>, <span class='object_link'><a href="Food.html#glycemic_index-instance_method" title="Food#glycemic_index (method)">#glycemic_index</a></span>, <span class='object_link'><a href="Food.html#name-instance_method" title="Food#name (method)">#name</a></span>, <span class='object_link'><a href="Food.html#nutrient_quantities-instance_method" title="Food#nutrient_quantities (method)">#nutrient_quantities</a></span></p>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<h2>Method Summary</h2>
|
130
|
+
|
131
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Food.html" title="Food (class)">Food</a></span></h3>
|
132
|
+
<p class="inherited"><span class='object_link'><a href="Food.html#<=>-instance_method" title="Food#<=> (method)">#<=></a></span>, <span class='object_link'><a href="Food.html#gi-instance_method" title="Food#gi (method)">#gi</a></span>, <span class='object_link'><a href="Food.html#iauc-instance_method" title="Food#iauc (method)">#iauc</a></span>, <span class='object_link'><a href="Food.html#individual_gi-instance_method" title="Food#individual_gi (method)">#individual_gi</a></span>, <span class='object_link'><a href="Food.html#initialize-instance_method" title="Food#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Food.html#nutrients_name-class_method" title="Food.nutrients_name (method)">nutrients_name</a></span>, <span class='object_link'><a href="Food.html#quantity_of_nutrient-instance_method" title="Food#quantity_of_nutrient (method)">#quantity_of_nutrient</a></span>, <span class='object_link'><a href="Food.html#to_s-instance_method" title="Food#to_s (method)">#to_s</a></span></p>
|
133
|
+
|
134
|
+
<div id="constructor_details" class="method_details_list">
|
135
|
+
<h2>Constructor Details</h2>
|
136
|
+
|
137
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Food.html#initialize-instance_method" title="Food#initialize (method)">Food</a></span></p>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div id="footer">
|
145
|
+
Generated on Tue Nov 28 21:26:18 2017 by
|
146
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
147
|
+
0.9.12 (ruby-2.3.0).
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</body>
|
152
|
+
</html>
|
data/docs/Food.html
ADDED
@@ -0,0 +1,1500 @@
|
|
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
|
+
Class: Food
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.12
|
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 = "Food";
|
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?1"></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 (F)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Food</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
|
+
<div id="content"><h1>Class: Food
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Food</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd>Comparable</dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/TDD/Food.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div id="subclasses">
|
108
|
+
<h2>Direct Known Subclasses</h2>
|
109
|
+
<p class="children"><span class='object_link'><a href="CarbohydrateRich.html" title="CarbohydrateRich (class)">CarbohydrateRich</a></span>, <span class='object_link'><a href="EggMilkAndDerivatives.html" title="EggMilkAndDerivatives (class)">EggMilkAndDerivatives</a></span>, <span class='object_link'><a href="Fish.html" title="Fish (class)">Fish</a></span>, <span class='object_link'><a href="Fruits.html" title="Fruits (class)">Fruits</a></span>, <span class='object_link'><a href="MeatAndDerivatives.html" title="MeatAndDerivatives (class)">MeatAndDerivatives</a></span>, <span class='object_link'><a href="OilsAndSweets.html" title="OilsAndSweets (class)">OilsAndSweets</a></span>, <span class='object_link'><a href="Vegetables.html" title="Vegetables (class)">Vegetables</a></span></p>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<h2>Constant Summary</h2>
|
113
|
+
<dl class="constants">
|
114
|
+
|
115
|
+
<dt id="DELTA_TIME-constant" class="">DELTA_TIME =
|
116
|
+
<div class="docstring">
|
117
|
+
<div class="discussion">
|
118
|
+
|
119
|
+
<p>Time interval between metrics (in minutes)</p>
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
<div class="tags">
|
125
|
+
|
126
|
+
|
127
|
+
</div>
|
128
|
+
</dt>
|
129
|
+
<dd><pre class="code"><span class='float'>5.0</span></pre></dd>
|
130
|
+
|
131
|
+
<dt id="nutrients_name-classvariable" class="">@@nutrients_name =
|
132
|
+
<div class="docstring">
|
133
|
+
<div class="discussion">
|
134
|
+
|
135
|
+
<p>Names of the nutrients</p>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
<div class="tags">
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
</dt>
|
145
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>proteins</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>carbohydrates</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fats</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span></pre></dd>
|
146
|
+
|
147
|
+
<dt id="nutients_energy_value-classvariable" class="">@@nutients_energy_value =
|
148
|
+
<div class="docstring">
|
149
|
+
<div class="discussion">
|
150
|
+
|
151
|
+
<p>Energy value (in Kcal) that each nutrient type gives</p>
|
152
|
+
|
153
|
+
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
<div class="tags">
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
</dt>
|
161
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='int'>4</span><span class='comma'>,</span> <span class='int'>4</span><span class='comma'>,</span> <span class='int'>9</span><span class='rbracket'>]</span></pre></dd>
|
162
|
+
|
163
|
+
</dl>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
169
|
+
<ul class="summary">
|
170
|
+
|
171
|
+
<li class="public ">
|
172
|
+
<span class="summary_signature">
|
173
|
+
|
174
|
+
<a href="#energetic_value-instance_method" title="#energetic_value (instance method)">#<strong>energetic_value</strong> ⇒ Float </a>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</span>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<span class="note title readonly">readonly</span>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc"><div class='inline'>
|
194
|
+
<p>Total energetic value of the food.</p>
|
195
|
+
</div></span>
|
196
|
+
|
197
|
+
</li>
|
198
|
+
|
199
|
+
|
200
|
+
<li class="public ">
|
201
|
+
<span class="summary_signature">
|
202
|
+
|
203
|
+
<a href="#glycemic_index-instance_method" title="#glycemic_index (instance method)">#<strong>glycemic_index</strong> ⇒ Float | nil </a>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
</span>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<span class="note title readonly">readonly</span>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'>
|
223
|
+
<p>Glycemic index for this food if it is calculated, nil otherwise.</p>
|
224
|
+
</div></span>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
|
229
|
+
<li class="public ">
|
230
|
+
<span class="summary_signature">
|
231
|
+
|
232
|
+
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ String </a>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
</span>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="note title readonly">readonly</span>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
<span class="summary_desc"><div class='inline'>
|
252
|
+
<p>Name of the food.</p>
|
253
|
+
</div></span>
|
254
|
+
|
255
|
+
</li>
|
256
|
+
|
257
|
+
|
258
|
+
<li class="public ">
|
259
|
+
<span class="summary_signature">
|
260
|
+
|
261
|
+
<a href="#nutrient_quantities-instance_method" title="#nutrient_quantities (instance method)">#<strong>nutrient_quantities</strong> ⇒ Array<Float> </a>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</span>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="note title readonly">readonly</span>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
<span class="summary_desc"><div class='inline'>
|
281
|
+
<p>Quantity in grams of each nutrient.</p>
|
282
|
+
</div></span>
|
283
|
+
|
284
|
+
</li>
|
285
|
+
|
286
|
+
|
287
|
+
</ul>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<h2>
|
294
|
+
Class Method Summary
|
295
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
296
|
+
</h2>
|
297
|
+
|
298
|
+
<ul class="summary">
|
299
|
+
|
300
|
+
<li class="public ">
|
301
|
+
<span class="summary_signature">
|
302
|
+
|
303
|
+
<a href="#nutrients_name-class_method" title="nutrients_name (class method)">.<strong>nutrients_name</strong> ⇒ Array<String> </a>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</span>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
<span class="summary_desc"><div class='inline'>
|
318
|
+
<p>Getter for the nutrients name.</p>
|
319
|
+
</div></span>
|
320
|
+
|
321
|
+
</li>
|
322
|
+
|
323
|
+
|
324
|
+
</ul>
|
325
|
+
|
326
|
+
<h2>
|
327
|
+
Instance Method Summary
|
328
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
329
|
+
</h2>
|
330
|
+
|
331
|
+
<ul class="summary">
|
332
|
+
|
333
|
+
<li class="public ">
|
334
|
+
<span class="summary_signature">
|
335
|
+
|
336
|
+
<a href="#<=>-instance_method" title="#<=> (instance method)">#<strong><=></strong>(o) ⇒ Fixnum </a>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
</span>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
<span class="summary_desc"><div class='inline'>
|
351
|
+
<p><=> operator, defined so instances could be comparable.</p>
|
352
|
+
</div></span>
|
353
|
+
|
354
|
+
</li>
|
355
|
+
|
356
|
+
|
357
|
+
<li class="public ">
|
358
|
+
<span class="summary_signature">
|
359
|
+
|
360
|
+
<a href="#gi-instance_method" title="#gi (instance method)">#<strong>gi</strong>(people_metrics) ⇒ Food </a>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</span>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
<span class="summary_desc"><div class='inline'>
|
375
|
+
<p>Calculates the glycemic index for the food given data of various people.</p>
|
376
|
+
</div></span>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
|
381
|
+
<li class="public ">
|
382
|
+
<span class="summary_signature">
|
383
|
+
|
384
|
+
<a href="#iauc-instance_method" title="#iauc (instance method)">#<strong>iauc</strong>(food_metrics) ⇒ Float </a>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</span>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
<span class="summary_desc"><div class='inline'>
|
399
|
+
<p>Calculates the incremental area under the curve for this food given the
|
400
|
+
glucose levels in blood for a person.</p>
|
401
|
+
</div></span>
|
402
|
+
|
403
|
+
</li>
|
404
|
+
|
405
|
+
|
406
|
+
<li class="public ">
|
407
|
+
<span class="summary_signature">
|
408
|
+
|
409
|
+
<a href="#individual_gi-instance_method" title="#individual_gi (instance method)">#<strong>individual_gi</strong>(food_metrics, glucose_metrics) ⇒ Float </a>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</span>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
<span class="summary_desc"><div class='inline'>
|
424
|
+
<p>Calculates the glycemic index of a person for the given food.</p>
|
425
|
+
</div></span>
|
426
|
+
|
427
|
+
</li>
|
428
|
+
|
429
|
+
|
430
|
+
<li class="public ">
|
431
|
+
<span class="summary_signature">
|
432
|
+
|
433
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name, nutrient_quantities) ⇒ Food </a>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
</span>
|
438
|
+
|
439
|
+
|
440
|
+
<span class="note title constructor">constructor</span>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
<span class="summary_desc"><div class='inline'>
|
450
|
+
<p>A new instance of Food.</p>
|
451
|
+
</div></span>
|
452
|
+
|
453
|
+
</li>
|
454
|
+
|
455
|
+
|
456
|
+
<li class="public ">
|
457
|
+
<span class="summary_signature">
|
458
|
+
|
459
|
+
<a href="#quantity_of_nutrient-instance_method" title="#quantity_of_nutrient (instance method)">#<strong>quantity_of_nutrient</strong>(n) ⇒ Float </a>
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
</span>
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
<span class="summary_desc"><div class='inline'>
|
474
|
+
<p>Given the name of a nutrient, #quantity_of_nutrient returns the quantity
|
475
|
+
(in grams) of that nutrient.</p>
|
476
|
+
</div></span>
|
477
|
+
|
478
|
+
</li>
|
479
|
+
|
480
|
+
|
481
|
+
<li class="public ">
|
482
|
+
<span class="summary_signature">
|
483
|
+
|
484
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ String </a>
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
</span>
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
<span class="summary_desc"><div class='inline'>
|
499
|
+
<p>to_s method.</p>
|
500
|
+
</div></span>
|
501
|
+
|
502
|
+
</li>
|
503
|
+
|
504
|
+
|
505
|
+
</ul>
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
<div id="constructor_details" class="method_details_list">
|
510
|
+
<h2>Constructor Details</h2>
|
511
|
+
|
512
|
+
<div class="method_details first">
|
513
|
+
<h3 class="signature first" id="initialize-instance_method">
|
514
|
+
|
515
|
+
#<strong>initialize</strong>(name, nutrient_quantities) ⇒ <tt><span class='object_link'><a href="" title="Food (class)">Food</a></span></tt>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
</h3><div class="docstring">
|
522
|
+
<div class="discussion">
|
523
|
+
|
524
|
+
<p>Returns a new instance of Food</p>
|
525
|
+
|
526
|
+
|
527
|
+
</div>
|
528
|
+
</div>
|
529
|
+
<div class="tags">
|
530
|
+
<p class="tag_title">Parameters:</p>
|
531
|
+
<ul class="param">
|
532
|
+
|
533
|
+
<li>
|
534
|
+
|
535
|
+
<span class='name'>name</span>
|
536
|
+
|
537
|
+
|
538
|
+
<span class='type'>(<tt>String</tt>)</span>
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
—
|
543
|
+
<div class='inline'>
|
544
|
+
<p>Name of the food</p>
|
545
|
+
</div>
|
546
|
+
|
547
|
+
</li>
|
548
|
+
|
549
|
+
<li>
|
550
|
+
|
551
|
+
<span class='name'>nutrient_quantities</span>
|
552
|
+
|
553
|
+
|
554
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><FixNum></tt>)</span>
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
—
|
559
|
+
<div class='inline'>
|
560
|
+
<p>An array with the values for the quantities of nutrients 0:grams of
|
561
|
+
proteins, 1:grams of carbohydrates, 2:grams of fats</p>
|
562
|
+
</div>
|
563
|
+
|
564
|
+
</li>
|
565
|
+
|
566
|
+
</ul>
|
567
|
+
|
568
|
+
<p class="tag_title">Raises:</p>
|
569
|
+
<ul class="raise">
|
570
|
+
|
571
|
+
<li>
|
572
|
+
|
573
|
+
|
574
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
</li>
|
579
|
+
|
580
|
+
</ul>
|
581
|
+
|
582
|
+
</div><table class="source_code">
|
583
|
+
<tr>
|
584
|
+
<td>
|
585
|
+
<pre class="lines">
|
586
|
+
|
587
|
+
|
588
|
+
30
|
589
|
+
31
|
590
|
+
32
|
591
|
+
33
|
592
|
+
34
|
593
|
+
35
|
594
|
+
36
|
595
|
+
37
|
596
|
+
38
|
597
|
+
39
|
598
|
+
40
|
599
|
+
41
|
600
|
+
42
|
601
|
+
43
|
602
|
+
44
|
603
|
+
45</pre>
|
604
|
+
</td>
|
605
|
+
<td>
|
606
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 30</span>
|
607
|
+
|
608
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_nutrient_quantities'>nutrient_quantities</span> <span class='rparen'>)</span>
|
609
|
+
<span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid number of nutrients values</span><span class='tstring_end'>'</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_nutrient_quantities'>nutrient_quantities</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='cvar'>@@nutrients_name</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span>
|
610
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
|
611
|
+
|
612
|
+
<span class='comment'># How much of each nutrient this food has
|
613
|
+
</span> <span class='ivar'>@nutrient_quantities</span> <span class='op'>=</span> <span class='id identifier rubyid_nutrient_quantities'>nutrient_quantities</span>
|
614
|
+
|
615
|
+
<span class='comment'># Total energetic value of this food instance
|
616
|
+
</span> <span class='ivar'>@energetic_value</span> <span class='op'>=</span> <span class='int'>0</span>
|
617
|
+
<span class='ivar'>@nutrient_quantities</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
618
|
+
<span class='ivar'>@energetic_value</span> <span class='op'>+=</span> <span class='ivar'>@nutrient_quantities</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='cvar'>@@nutients_energy_value</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span>
|
619
|
+
<span class='kw'>end</span>
|
620
|
+
|
621
|
+
<span class='comment'># Setting the glycemic index to a default value
|
622
|
+
</span> <span class='ivar'>@glycemic_index</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
623
|
+
<span class='kw'>end</span></pre>
|
624
|
+
</td>
|
625
|
+
</tr>
|
626
|
+
</table>
|
627
|
+
</div>
|
628
|
+
|
629
|
+
</div>
|
630
|
+
|
631
|
+
<div id="instance_attr_details" class="attr_details">
|
632
|
+
<h2>Instance Attribute Details</h2>
|
633
|
+
|
634
|
+
|
635
|
+
<span id=""></span>
|
636
|
+
<div class="method_details first">
|
637
|
+
<h3 class="signature first" id="energetic_value-instance_method">
|
638
|
+
|
639
|
+
#<strong>energetic_value</strong> ⇒ <tt>Float</tt> <span class="extras">(readonly)</span>
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
</h3><div class="docstring">
|
646
|
+
<div class="discussion">
|
647
|
+
|
648
|
+
<p>Returns Total energetic value of the food</p>
|
649
|
+
|
650
|
+
|
651
|
+
</div>
|
652
|
+
</div>
|
653
|
+
<div class="tags">
|
654
|
+
|
655
|
+
<p class="tag_title">Returns:</p>
|
656
|
+
<ul class="return">
|
657
|
+
|
658
|
+
<li>
|
659
|
+
|
660
|
+
|
661
|
+
<span class='type'>(<tt>Float</tt>)</span>
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
—
|
666
|
+
<div class='inline'>
|
667
|
+
<p>Total energetic value of the food</p>
|
668
|
+
</div>
|
669
|
+
|
670
|
+
</li>
|
671
|
+
|
672
|
+
</ul>
|
673
|
+
|
674
|
+
</div><table class="source_code">
|
675
|
+
<tr>
|
676
|
+
<td>
|
677
|
+
<pre class="lines">
|
678
|
+
|
679
|
+
|
680
|
+
23
|
681
|
+
24
|
682
|
+
25</pre>
|
683
|
+
</td>
|
684
|
+
<td>
|
685
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 23</span>
|
686
|
+
|
687
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_energetic_value'>energetic_value</span>
|
688
|
+
<span class='ivar'>@energetic_value</span>
|
689
|
+
<span class='kw'>end</span></pre>
|
690
|
+
</td>
|
691
|
+
</tr>
|
692
|
+
</table>
|
693
|
+
</div>
|
694
|
+
|
695
|
+
|
696
|
+
<span id=""></span>
|
697
|
+
<div class="method_details ">
|
698
|
+
<h3 class="signature " id="glycemic_index-instance_method">
|
699
|
+
|
700
|
+
#<strong>glycemic_index</strong> ⇒ <tt>Float | nil</tt> <span class="extras">(readonly)</span>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
</h3><div class="docstring">
|
707
|
+
<div class="discussion">
|
708
|
+
|
709
|
+
<p>Returns Glycemic index for this food if it is calculated, nil otherwise</p>
|
710
|
+
|
711
|
+
|
712
|
+
</div>
|
713
|
+
</div>
|
714
|
+
<div class="tags">
|
715
|
+
|
716
|
+
<p class="tag_title">Returns:</p>
|
717
|
+
<ul class="return">
|
718
|
+
|
719
|
+
<li>
|
720
|
+
|
721
|
+
|
722
|
+
<span class='type'>(<tt>Float | nil</tt>)</span>
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
—
|
727
|
+
<div class='inline'>
|
728
|
+
<p>Glycemic index for this food if it is calculated, nil otherwise</p>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
</li>
|
732
|
+
|
733
|
+
</ul>
|
734
|
+
|
735
|
+
</div><table class="source_code">
|
736
|
+
<tr>
|
737
|
+
<td>
|
738
|
+
<pre class="lines">
|
739
|
+
|
740
|
+
|
741
|
+
26
|
742
|
+
27
|
743
|
+
28</pre>
|
744
|
+
</td>
|
745
|
+
<td>
|
746
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 26</span>
|
747
|
+
|
748
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_glycemic_index'>glycemic_index</span>
|
749
|
+
<span class='ivar'>@glycemic_index</span>
|
750
|
+
<span class='kw'>end</span></pre>
|
751
|
+
</td>
|
752
|
+
</tr>
|
753
|
+
</table>
|
754
|
+
</div>
|
755
|
+
|
756
|
+
|
757
|
+
<span id=""></span>
|
758
|
+
<div class="method_details ">
|
759
|
+
<h3 class="signature " id="name-instance_method">
|
760
|
+
|
761
|
+
#<strong>name</strong> ⇒ <tt>String</tt> <span class="extras">(readonly)</span>
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
</h3><div class="docstring">
|
768
|
+
<div class="discussion">
|
769
|
+
|
770
|
+
<p>Returns Name of the food</p>
|
771
|
+
|
772
|
+
|
773
|
+
</div>
|
774
|
+
</div>
|
775
|
+
<div class="tags">
|
776
|
+
|
777
|
+
<p class="tag_title">Returns:</p>
|
778
|
+
<ul class="return">
|
779
|
+
|
780
|
+
<li>
|
781
|
+
|
782
|
+
|
783
|
+
<span class='type'>(<tt>String</tt>)</span>
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
—
|
788
|
+
<div class='inline'>
|
789
|
+
<p>Name of the food</p>
|
790
|
+
</div>
|
791
|
+
|
792
|
+
</li>
|
793
|
+
|
794
|
+
</ul>
|
795
|
+
|
796
|
+
</div><table class="source_code">
|
797
|
+
<tr>
|
798
|
+
<td>
|
799
|
+
<pre class="lines">
|
800
|
+
|
801
|
+
|
802
|
+
17
|
803
|
+
18
|
804
|
+
19</pre>
|
805
|
+
</td>
|
806
|
+
<td>
|
807
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 17</span>
|
808
|
+
|
809
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
810
|
+
<span class='ivar'>@name</span>
|
811
|
+
<span class='kw'>end</span></pre>
|
812
|
+
</td>
|
813
|
+
</tr>
|
814
|
+
</table>
|
815
|
+
</div>
|
816
|
+
|
817
|
+
|
818
|
+
<span id=""></span>
|
819
|
+
<div class="method_details ">
|
820
|
+
<h3 class="signature " id="nutrient_quantities-instance_method">
|
821
|
+
|
822
|
+
#<strong>nutrient_quantities</strong> ⇒ <tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Float></tt> <span class="extras">(readonly)</span>
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
|
828
|
+
</h3><div class="docstring">
|
829
|
+
<div class="discussion">
|
830
|
+
|
831
|
+
<p>Returns Quantity in grams of each nutrient</p>
|
832
|
+
|
833
|
+
|
834
|
+
</div>
|
835
|
+
</div>
|
836
|
+
<div class="tags">
|
837
|
+
|
838
|
+
<p class="tag_title">Returns:</p>
|
839
|
+
<ul class="return">
|
840
|
+
|
841
|
+
<li>
|
842
|
+
|
843
|
+
|
844
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Float></tt>)</span>
|
845
|
+
|
846
|
+
|
847
|
+
|
848
|
+
—
|
849
|
+
<div class='inline'>
|
850
|
+
<p>Quantity in grams of each nutrient</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
|
+
20
|
864
|
+
21
|
865
|
+
22</pre>
|
866
|
+
</td>
|
867
|
+
<td>
|
868
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 20</span>
|
869
|
+
|
870
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_nutrient_quantities'>nutrient_quantities</span>
|
871
|
+
<span class='ivar'>@nutrient_quantities</span>
|
872
|
+
<span class='kw'>end</span></pre>
|
873
|
+
</td>
|
874
|
+
</tr>
|
875
|
+
</table>
|
876
|
+
</div>
|
877
|
+
|
878
|
+
</div>
|
879
|
+
|
880
|
+
|
881
|
+
<div id="class_method_details" class="method_details_list">
|
882
|
+
<h2>Class Method Details</h2>
|
883
|
+
|
884
|
+
|
885
|
+
<div class="method_details first">
|
886
|
+
<h3 class="signature first" id="nutrients_name-class_method">
|
887
|
+
|
888
|
+
.<strong>nutrients_name</strong> ⇒ <tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><String></tt>
|
889
|
+
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
|
894
|
+
</h3><div class="docstring">
|
895
|
+
<div class="discussion">
|
896
|
+
|
897
|
+
<p>Getter for the nutrients name</p>
|
898
|
+
|
899
|
+
|
900
|
+
</div>
|
901
|
+
</div>
|
902
|
+
<div class="tags">
|
903
|
+
|
904
|
+
<p class="tag_title">Returns:</p>
|
905
|
+
<ul class="return">
|
906
|
+
|
907
|
+
<li>
|
908
|
+
|
909
|
+
|
910
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><String></tt>)</span>
|
911
|
+
|
912
|
+
|
913
|
+
|
914
|
+
—
|
915
|
+
<div class='inline'>
|
916
|
+
<p>Array with the names of the nutrients</p>
|
917
|
+
</div>
|
918
|
+
|
919
|
+
</li>
|
920
|
+
|
921
|
+
</ul>
|
922
|
+
|
923
|
+
</div><table class="source_code">
|
924
|
+
<tr>
|
925
|
+
<td>
|
926
|
+
<pre class="lines">
|
927
|
+
|
928
|
+
|
929
|
+
9
|
930
|
+
10
|
931
|
+
11</pre>
|
932
|
+
</td>
|
933
|
+
<td>
|
934
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 9</span>
|
935
|
+
|
936
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_nutrients_name'>nutrients_name</span>
|
937
|
+
<span class='cvar'>@@nutrients_name</span>
|
938
|
+
<span class='kw'>end</span></pre>
|
939
|
+
</td>
|
940
|
+
</tr>
|
941
|
+
</table>
|
942
|
+
</div>
|
943
|
+
|
944
|
+
</div>
|
945
|
+
|
946
|
+
<div id="instance_method_details" class="method_details_list">
|
947
|
+
<h2>Instance Method Details</h2>
|
948
|
+
|
949
|
+
|
950
|
+
<div class="method_details first">
|
951
|
+
<h3 class="signature first" id="<=>-instance_method">
|
952
|
+
|
953
|
+
#<strong><=></strong>(o) ⇒ <tt>Fixnum</tt>
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
|
959
|
+
</h3><div class="docstring">
|
960
|
+
<div class="discussion">
|
961
|
+
|
962
|
+
<div class="note notetag">
|
963
|
+
<strong>Note:</strong>
|
964
|
+
<div class='inline'>
|
965
|
+
<p>We consider two foods to be equal if their energetic value is the samew</p>
|
966
|
+
</div>
|
967
|
+
</div>
|
968
|
+
|
969
|
+
|
970
|
+
<p><=> operator, defined so instances could be comparable</p>
|
971
|
+
|
972
|
+
|
973
|
+
</div>
|
974
|
+
</div>
|
975
|
+
<div class="tags">
|
976
|
+
|
977
|
+
<p class="tag_title">Returns:</p>
|
978
|
+
<ul class="return">
|
979
|
+
|
980
|
+
<li>
|
981
|
+
|
982
|
+
|
983
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
984
|
+
|
985
|
+
|
986
|
+
|
987
|
+
</li>
|
988
|
+
|
989
|
+
</ul>
|
990
|
+
|
991
|
+
</div><table class="source_code">
|
992
|
+
<tr>
|
993
|
+
<td>
|
994
|
+
<pre class="lines">
|
995
|
+
|
996
|
+
|
997
|
+
71
|
998
|
+
72
|
999
|
+
73</pre>
|
1000
|
+
</td>
|
1001
|
+
<td>
|
1002
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 71</span>
|
1003
|
+
|
1004
|
+
<span class='kw'>def</span> <span class='op'><=></span><span class='lparen'>(</span><span class='id identifier rubyid_o'>o</span><span class='rparen'>)</span>
|
1005
|
+
<span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_energetic_value'>energetic_value</span> <span class='op'><=></span> <span class='id identifier rubyid_o'>o</span><span class='period'>.</span><span class='id identifier rubyid_energetic_value'>energetic_value</span>
|
1006
|
+
<span class='kw'>end</span></pre>
|
1007
|
+
</td>
|
1008
|
+
</tr>
|
1009
|
+
</table>
|
1010
|
+
</div>
|
1011
|
+
|
1012
|
+
<div class="method_details ">
|
1013
|
+
<h3 class="signature " id="gi-instance_method">
|
1014
|
+
|
1015
|
+
#<strong>gi</strong>(people_metrics) ⇒ <tt><span class='object_link'><a href="" title="Food (class)">Food</a></span></tt>
|
1016
|
+
|
1017
|
+
|
1018
|
+
|
1019
|
+
|
1020
|
+
|
1021
|
+
</h3><div class="docstring">
|
1022
|
+
<div class="discussion">
|
1023
|
+
|
1024
|
+
<p>Calculates the glycemic index for the food given data of various people</p>
|
1025
|
+
|
1026
|
+
|
1027
|
+
</div>
|
1028
|
+
</div>
|
1029
|
+
<div class="tags">
|
1030
|
+
<p class="tag_title">Parameters:</p>
|
1031
|
+
<ul class="param">
|
1032
|
+
|
1033
|
+
<li>
|
1034
|
+
|
1035
|
+
<span class='name'>People</span>
|
1036
|
+
|
1037
|
+
|
1038
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Hash<Symbol, <span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Float>>></tt>)</span>
|
1039
|
+
|
1040
|
+
|
1041
|
+
|
1042
|
+
—
|
1043
|
+
<div class='inline'>
|
1044
|
+
<p>metrics, each hash in the array is the data for a person, the hash has to
|
1045
|
+
have :food_metrics and :glucose_metrics keys which values are the arrays
|
1046
|
+
corresponding to the glucose in blood metric after the food and the pure
|
1047
|
+
glucose respectively.</p>
|
1048
|
+
</div>
|
1049
|
+
|
1050
|
+
</li>
|
1051
|
+
|
1052
|
+
</ul>
|
1053
|
+
|
1054
|
+
<p class="tag_title">Returns:</p>
|
1055
|
+
<ul class="return">
|
1056
|
+
|
1057
|
+
<li>
|
1058
|
+
|
1059
|
+
|
1060
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Food (class)">Food</a></span></tt>)</span>
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1064
|
+
—
|
1065
|
+
<div class='inline'>
|
1066
|
+
<p>Returns selfs so other methods could be chained</p>
|
1067
|
+
</div>
|
1068
|
+
|
1069
|
+
</li>
|
1070
|
+
|
1071
|
+
</ul>
|
1072
|
+
|
1073
|
+
</div><table class="source_code">
|
1074
|
+
<tr>
|
1075
|
+
<td>
|
1076
|
+
<pre class="lines">
|
1077
|
+
|
1078
|
+
|
1079
|
+
100
|
1080
|
+
101
|
1081
|
+
102
|
1082
|
+
103
|
1083
|
+
104
|
1084
|
+
105
|
1085
|
+
106
|
1086
|
+
107
|
1087
|
+
108</pre>
|
1088
|
+
</td>
|
1089
|
+
<td>
|
1090
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 100</span>
|
1091
|
+
|
1092
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_gi'>gi</span><span class='lparen'>(</span><span class='id identifier rubyid_people_metrics'>people_metrics</span><span class='rparen'>)</span>
|
1093
|
+
<span class='id identifier rubyid_people_igs'>people_igs</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1094
|
+
<span class='id identifier rubyid_people_metrics'>people_metrics</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_person_metrics'>person_metrics</span><span class='op'>|</span>
|
1095
|
+
<span class='id identifier rubyid_people_igs'>people_igs</span> <span class='op'><<</span> <span class='id identifier rubyid_individual_gi'>individual_gi</span><span class='lparen'>(</span><span class='id identifier rubyid_person_metrics'>person_metrics</span><span class='lbracket'>[</span><span class='symbol'>:food_metrics</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_person_metrics'>person_metrics</span><span class='lbracket'>[</span><span class='symbol'>:glucose_metrics</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1096
|
+
<span class='kw'>end</span>
|
1097
|
+
|
1098
|
+
<span class='ivar'>@glycemic_index</span> <span class='op'>=</span> <span class='id identifier rubyid_people_igs'>people_igs</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='float'>0.0</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='id identifier rubyid_people_igs'>people_igs</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
1099
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
1100
|
+
<span class='kw'>end</span></pre>
|
1101
|
+
</td>
|
1102
|
+
</tr>
|
1103
|
+
</table>
|
1104
|
+
</div>
|
1105
|
+
|
1106
|
+
<div class="method_details ">
|
1107
|
+
<h3 class="signature " id="iauc-instance_method">
|
1108
|
+
|
1109
|
+
#<strong>iauc</strong>(food_metrics) ⇒ <tt>Float</tt>
|
1110
|
+
|
1111
|
+
|
1112
|
+
|
1113
|
+
|
1114
|
+
|
1115
|
+
</h3><div class="docstring">
|
1116
|
+
<div class="discussion">
|
1117
|
+
|
1118
|
+
<p>Calculates the incremental area under the curve for this food given the
|
1119
|
+
glucose levels in blood for a person.</p>
|
1120
|
+
|
1121
|
+
|
1122
|
+
</div>
|
1123
|
+
</div>
|
1124
|
+
<div class="tags">
|
1125
|
+
<p class="tag_title">Parameters:</p>
|
1126
|
+
<ul class="param">
|
1127
|
+
|
1128
|
+
<li>
|
1129
|
+
|
1130
|
+
<span class='name'>food_metrics</span>
|
1131
|
+
|
1132
|
+
|
1133
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Float></tt>)</span>
|
1134
|
+
|
1135
|
+
|
1136
|
+
|
1137
|
+
—
|
1138
|
+
<div class='inline'>
|
1139
|
+
<p>Glucose in blood metrics of a person, taken each DELTA_TIME minutes for a
|
1140
|
+
given food</p>
|
1141
|
+
</div>
|
1142
|
+
|
1143
|
+
</li>
|
1144
|
+
|
1145
|
+
</ul>
|
1146
|
+
|
1147
|
+
<p class="tag_title">Returns:</p>
|
1148
|
+
<ul class="return">
|
1149
|
+
|
1150
|
+
<li>
|
1151
|
+
|
1152
|
+
|
1153
|
+
<span class='type'>(<tt>Float</tt>)</span>
|
1154
|
+
|
1155
|
+
|
1156
|
+
|
1157
|
+
—
|
1158
|
+
<div class='inline'>
|
1159
|
+
<p>Area under the curve of the metrics</p>
|
1160
|
+
</div>
|
1161
|
+
|
1162
|
+
</li>
|
1163
|
+
|
1164
|
+
</ul>
|
1165
|
+
<p class="tag_title">Raises:</p>
|
1166
|
+
<ul class="raise">
|
1167
|
+
|
1168
|
+
<li>
|
1169
|
+
|
1170
|
+
|
1171
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1172
|
+
|
1173
|
+
|
1174
|
+
|
1175
|
+
</li>
|
1176
|
+
|
1177
|
+
</ul>
|
1178
|
+
|
1179
|
+
</div><table class="source_code">
|
1180
|
+
<tr>
|
1181
|
+
<td>
|
1182
|
+
<pre class="lines">
|
1183
|
+
|
1184
|
+
|
1185
|
+
81
|
1186
|
+
82
|
1187
|
+
83
|
1188
|
+
84
|
1189
|
+
85</pre>
|
1190
|
+
</td>
|
1191
|
+
<td>
|
1192
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 81</span>
|
1193
|
+
|
1194
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_iauc'>iauc</span><span class='lparen'>(</span><span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='rparen'>)</span>
|
1195
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Need at least 2 values to calculate the first trapezoid area</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>1</span><span class='rparen'>)</span>
|
1196
|
+
|
1197
|
+
<span class='const'><span class='object_link'><a href="#DELTA_TIME-constant" title="Food::DELTA_TIME (constant)">DELTA_TIME</a></span></span><span class='op'>/</span><span class='float'>2.0</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='period'>.</span><span class='id identifier rubyid_drop'>drop</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='float'>0.0</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='period'>.</span><span class='id identifier rubyid_take'>take</span><span class='lparen'>(</span><span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='float'>0.0</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='float'>2.0</span> <span class='op'>*</span> <span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span>
|
1198
|
+
<span class='kw'>end</span></pre>
|
1199
|
+
</td>
|
1200
|
+
</tr>
|
1201
|
+
</table>
|
1202
|
+
</div>
|
1203
|
+
|
1204
|
+
<div class="method_details ">
|
1205
|
+
<h3 class="signature " id="individual_gi-instance_method">
|
1206
|
+
|
1207
|
+
#<strong>individual_gi</strong>(food_metrics, glucose_metrics) ⇒ <tt>Float</tt>
|
1208
|
+
|
1209
|
+
|
1210
|
+
|
1211
|
+
|
1212
|
+
|
1213
|
+
</h3><div class="docstring">
|
1214
|
+
<div class="discussion">
|
1215
|
+
|
1216
|
+
<p>Calculates the glycemic index of a person for the given food</p>
|
1217
|
+
|
1218
|
+
|
1219
|
+
</div>
|
1220
|
+
</div>
|
1221
|
+
<div class="tags">
|
1222
|
+
<p class="tag_title">Parameters:</p>
|
1223
|
+
<ul class="param">
|
1224
|
+
|
1225
|
+
<li>
|
1226
|
+
|
1227
|
+
<span class='name'>glucose_metrics</span>
|
1228
|
+
|
1229
|
+
|
1230
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Float></tt>)</span>
|
1231
|
+
|
1232
|
+
|
1233
|
+
|
1234
|
+
—
|
1235
|
+
<div class='inline'>
|
1236
|
+
<p>Glucose in blood metrics of a person, taken each DELTA_TIME minutes for
|
1237
|
+
pure glucose</p>
|
1238
|
+
</div>
|
1239
|
+
|
1240
|
+
</li>
|
1241
|
+
|
1242
|
+
<li>
|
1243
|
+
|
1244
|
+
<span class='name'>food_metrics</span>
|
1245
|
+
|
1246
|
+
|
1247
|
+
<span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span><Float></tt>)</span>
|
1248
|
+
|
1249
|
+
|
1250
|
+
|
1251
|
+
—
|
1252
|
+
<div class='inline'>
|
1253
|
+
<p>Glucose in blood metrics of a person, taken each DELTA_TIME minutes for a
|
1254
|
+
given food</p>
|
1255
|
+
</div>
|
1256
|
+
|
1257
|
+
</li>
|
1258
|
+
|
1259
|
+
</ul>
|
1260
|
+
|
1261
|
+
<p class="tag_title">Returns:</p>
|
1262
|
+
<ul class="return">
|
1263
|
+
|
1264
|
+
<li>
|
1265
|
+
|
1266
|
+
|
1267
|
+
<span class='type'>(<tt>Float</tt>)</span>
|
1268
|
+
|
1269
|
+
|
1270
|
+
|
1271
|
+
—
|
1272
|
+
<div class='inline'>
|
1273
|
+
<p>Glycemic index of a person for the given food</p>
|
1274
|
+
</div>
|
1275
|
+
|
1276
|
+
</li>
|
1277
|
+
|
1278
|
+
</ul>
|
1279
|
+
<p class="tag_title">Raises:</p>
|
1280
|
+
<ul class="raise">
|
1281
|
+
|
1282
|
+
<li>
|
1283
|
+
|
1284
|
+
|
1285
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1286
|
+
|
1287
|
+
|
1288
|
+
|
1289
|
+
</li>
|
1290
|
+
|
1291
|
+
</ul>
|
1292
|
+
|
1293
|
+
</div><table class="source_code">
|
1294
|
+
<tr>
|
1295
|
+
<td>
|
1296
|
+
<pre class="lines">
|
1297
|
+
|
1298
|
+
|
1299
|
+
91
|
1300
|
+
92
|
1301
|
+
93
|
1302
|
+
94
|
1303
|
+
95</pre>
|
1304
|
+
</td>
|
1305
|
+
<td>
|
1306
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 91</span>
|
1307
|
+
|
1308
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_individual_gi'>individual_gi</span><span class='lparen'>(</span><span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='comma'>,</span> <span class='id identifier rubyid_glucose_metrics'>glucose_metrics</span><span class='rparen'>)</span>
|
1309
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sizes don't match</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='id identifier rubyid_glucose_metrics'>glucose_metrics</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
1310
|
+
|
1311
|
+
<span class='id identifier rubyid_iauc'>iauc</span><span class='lparen'>(</span><span class='id identifier rubyid_food_metrics'>food_metrics</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='id identifier rubyid_iauc'>iauc</span><span class='lparen'>(</span><span class='id identifier rubyid_glucose_metrics'>glucose_metrics</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='float'>100.0</span>
|
1312
|
+
<span class='kw'>end</span></pre>
|
1313
|
+
</td>
|
1314
|
+
</tr>
|
1315
|
+
</table>
|
1316
|
+
</div>
|
1317
|
+
|
1318
|
+
<div class="method_details ">
|
1319
|
+
<h3 class="signature " id="quantity_of_nutrient-instance_method">
|
1320
|
+
|
1321
|
+
#<strong>quantity_of_nutrient</strong>(n) ⇒ <tt>Float</tt>
|
1322
|
+
|
1323
|
+
|
1324
|
+
|
1325
|
+
|
1326
|
+
|
1327
|
+
</h3><div class="docstring">
|
1328
|
+
<div class="discussion">
|
1329
|
+
|
1330
|
+
<p>Given the name of a nutrient, #quantity_of_nutrient returns the quantity
|
1331
|
+
(in grams) of that nutrient</p>
|
1332
|
+
|
1333
|
+
|
1334
|
+
</div>
|
1335
|
+
</div>
|
1336
|
+
<div class="tags">
|
1337
|
+
<p class="tag_title">Parameters:</p>
|
1338
|
+
<ul class="param">
|
1339
|
+
|
1340
|
+
<li>
|
1341
|
+
|
1342
|
+
<span class='name'>n</span>
|
1343
|
+
|
1344
|
+
|
1345
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1346
|
+
|
1347
|
+
|
1348
|
+
|
1349
|
+
—
|
1350
|
+
<div class='inline'>
|
1351
|
+
<p>The name of the nutrient. The value has to be one of “proteins”,
|
1352
|
+
“carbohydrates”, “fats”</p>
|
1353
|
+
</div>
|
1354
|
+
|
1355
|
+
</li>
|
1356
|
+
|
1357
|
+
</ul>
|
1358
|
+
|
1359
|
+
<p class="tag_title">Returns:</p>
|
1360
|
+
<ul class="return">
|
1361
|
+
|
1362
|
+
<li>
|
1363
|
+
|
1364
|
+
|
1365
|
+
<span class='type'>(<tt>Float</tt>)</span>
|
1366
|
+
|
1367
|
+
|
1368
|
+
|
1369
|
+
—
|
1370
|
+
<div class='inline'>
|
1371
|
+
<p>The quantity (in grams) of the nutrient requested that the food has</p>
|
1372
|
+
</div>
|
1373
|
+
|
1374
|
+
</li>
|
1375
|
+
|
1376
|
+
</ul>
|
1377
|
+
<p class="tag_title">Raises:</p>
|
1378
|
+
<ul class="raise">
|
1379
|
+
|
1380
|
+
<li>
|
1381
|
+
|
1382
|
+
|
1383
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1384
|
+
|
1385
|
+
|
1386
|
+
|
1387
|
+
</li>
|
1388
|
+
|
1389
|
+
</ul>
|
1390
|
+
|
1391
|
+
</div><table class="source_code">
|
1392
|
+
<tr>
|
1393
|
+
<td>
|
1394
|
+
<pre class="lines">
|
1395
|
+
|
1396
|
+
|
1397
|
+
50
|
1398
|
+
51
|
1399
|
+
52
|
1400
|
+
53
|
1401
|
+
54
|
1402
|
+
55
|
1403
|
+
56</pre>
|
1404
|
+
</td>
|
1405
|
+
<td>
|
1406
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 50</span>
|
1407
|
+
|
1408
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_quantity_of_nutrient'>quantity_of_nutrient</span><span class='lparen'>(</span> <span class='id identifier rubyid_n'>n</span> <span class='rparen'>)</span>
|
1409
|
+
<span class='comment'># index method returns nil if the element doesn't exist
|
1410
|
+
</span> <span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='cvar'>@@nutrients_name</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span> <span class='id identifier rubyid_n'>n</span> <span class='rparen'>)</span>
|
1411
|
+
<span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid nutrient name</span><span class='tstring_end'>'</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_index'>index</span>
|
1412
|
+
|
1413
|
+
<span class='kw'>return</span> <span class='ivar'>@nutrient_quantities</span><span class='lbracket'>[</span> <span class='id identifier rubyid_index'>index</span> <span class='rbracket'>]</span>
|
1414
|
+
<span class='kw'>end</span></pre>
|
1415
|
+
</td>
|
1416
|
+
</tr>
|
1417
|
+
</table>
|
1418
|
+
</div>
|
1419
|
+
|
1420
|
+
<div class="method_details ">
|
1421
|
+
<h3 class="signature " id="to_s-instance_method">
|
1422
|
+
|
1423
|
+
#<strong>to_s</strong> ⇒ <tt>String</tt>
|
1424
|
+
|
1425
|
+
|
1426
|
+
|
1427
|
+
|
1428
|
+
|
1429
|
+
</h3><div class="docstring">
|
1430
|
+
<div class="discussion">
|
1431
|
+
|
1432
|
+
<p>to_s method</p>
|
1433
|
+
|
1434
|
+
|
1435
|
+
</div>
|
1436
|
+
</div>
|
1437
|
+
<div class="tags">
|
1438
|
+
|
1439
|
+
<p class="tag_title">Returns:</p>
|
1440
|
+
<ul class="return">
|
1441
|
+
|
1442
|
+
<li>
|
1443
|
+
|
1444
|
+
|
1445
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1446
|
+
|
1447
|
+
|
1448
|
+
|
1449
|
+
—
|
1450
|
+
<div class='inline'>
|
1451
|
+
<p>The format is “<food_name>: <protein_quantity>g,
|
1452
|
+
<carbohydrates_quantity>g, <fat_quantity>g”</p>
|
1453
|
+
</div>
|
1454
|
+
|
1455
|
+
</li>
|
1456
|
+
|
1457
|
+
</ul>
|
1458
|
+
|
1459
|
+
</div><table class="source_code">
|
1460
|
+
<tr>
|
1461
|
+
<td>
|
1462
|
+
<pre class="lines">
|
1463
|
+
|
1464
|
+
|
1465
|
+
60
|
1466
|
+
61
|
1467
|
+
62
|
1468
|
+
63
|
1469
|
+
64
|
1470
|
+
65
|
1471
|
+
66</pre>
|
1472
|
+
</td>
|
1473
|
+
<td>
|
1474
|
+
<pre class="code"><span class="info file"># File 'lib/TDD/Food.rb', line 60</span>
|
1475
|
+
|
1476
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
1477
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='ivar'>@name</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>: </span><span class='tstring_end'>'</span></span>
|
1478
|
+
<span class='lparen'>(</span><span class='ivar'>@nutrient_quantities</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</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='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
1479
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@nutrient_quantities</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>g of </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@nutrients_name</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='tstring_end'>"</span></span>
|
1480
|
+
<span class='kw'>end</span>
|
1481
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@nutrient_quantities</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>g of </span><span class='embexpr_beg'>#{</span><span class='cvar'>@@nutrients_name</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1482
|
+
<span class='kw'>end</span></pre>
|
1483
|
+
</td>
|
1484
|
+
</tr>
|
1485
|
+
</table>
|
1486
|
+
</div>
|
1487
|
+
|
1488
|
+
</div>
|
1489
|
+
|
1490
|
+
</div>
|
1491
|
+
|
1492
|
+
<div id="footer">
|
1493
|
+
Generated on Tue Nov 28 21:26:18 2017 by
|
1494
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1495
|
+
0.9.12 (ruby-2.3.0).
|
1496
|
+
</div>
|
1497
|
+
|
1498
|
+
</div>
|
1499
|
+
</body>
|
1500
|
+
</html>
|