huella 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +97 -0
- data/Guardfile +82 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimento.html +627 -0
- data/docs/Gemfile.html +98 -0
- data/docs/Gemfile_lock.html +179 -0
- data/docs/Guardfile.html +165 -0
- data/docs/Huella/Error.html +103 -0
- data/docs/Huella.html +114 -0
- data/docs/Lista.html +981 -0
- data/docs/Object.html +337 -0
- data/docs/PlatoAmbiental.html +436 -0
- data/docs/PlatoNutricional.html +517 -0
- data/docs/README_md.html +146 -0
- data/docs/Rakefile.html +100 -0
- data/docs/bin/setup.html +100 -0
- data/docs/created.rid +24 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +590 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/huella_gemspec.html +133 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +117 -0
- data/docs/js/darkfish.js +161 -0
- data/docs/js/jquery.js +4 -0
- data/docs/js/navigation.js +141 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +109 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +378 -0
- data/huella.gemspec +38 -0
- data/lib/huella/alimento.rb +112 -0
- data/lib/huella/lista.rb +275 -0
- data/lib/huella/menu_dsl.rb +92 -0
- data/lib/huella/nodo.rb +7 -0
- data/lib/huella/plato_ambiental.rb +100 -0
- data/lib/huella/plato_dsl.rb +89 -0
- data/lib/huella/plato_nutricional.rb +102 -0
- data/lib/huella/version.rb +4 -0
- data/lib/huella.rb +14 -0
- metadata +238 -0
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>class PlatoNutricional - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<script type="text/javascript">
|
|
10
|
+
var rdoc_rel_prefix = "./";
|
|
11
|
+
var index_rel_prefix = "./";
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script src="./js/jquery.js"></script>
|
|
15
|
+
<script src="./js/darkfish.js"></script>
|
|
16
|
+
|
|
17
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
|
18
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body id="top" role="document" class="class">
|
|
24
|
+
<nav role="navigation">
|
|
25
|
+
<div id="project-navigation">
|
|
26
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
27
|
+
<h2>
|
|
28
|
+
<a href="./index.html" rel="home">Home</a>
|
|
29
|
+
</h2>
|
|
30
|
+
|
|
31
|
+
<div id="table-of-contents-navigation">
|
|
32
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
|
33
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
34
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
39
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
40
|
+
<div id="search-field-wrapper">
|
|
41
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
42
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
43
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
44
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<ul id="search-results" aria-label="Search Results"
|
|
48
|
+
aria-busy="false" aria-expanded="false"
|
|
49
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
50
|
+
</form>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<div id="class-metadata">
|
|
58
|
+
|
|
59
|
+
<div id="parent-class-section" class="nav-section">
|
|
60
|
+
<h3>Parent</h3>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<p class="link"><a href="Object.html">Object</a>
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div id="includes-section" class="nav-section">
|
|
68
|
+
<h3>Included Modules</h3>
|
|
69
|
+
|
|
70
|
+
<ul class="link-list">
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<li><span class="include">Comparable</span>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
</ul>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
<!-- Method Quickref -->
|
|
81
|
+
<div id="method-list-section" class="nav-section">
|
|
82
|
+
<h3>Methods</h3>
|
|
83
|
+
|
|
84
|
+
<ul class="link-list" role="directory">
|
|
85
|
+
|
|
86
|
+
<li ><a href="#method-c-new">::new</a>
|
|
87
|
+
|
|
88
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
|
89
|
+
|
|
90
|
+
<li ><a href="#method-i-3D-3D">#==</a>
|
|
91
|
+
|
|
92
|
+
<li ><a href="#method-i-getPorcentajeCarbohidratosPlato">#getPorcentajeCarbohidratosPlato</a>
|
|
93
|
+
|
|
94
|
+
<li ><a href="#method-i-getPorcentajeLipidosPlato">#getPorcentajeLipidosPlato</a>
|
|
95
|
+
|
|
96
|
+
<li ><a href="#method-i-getPorcentajeProteinasPlato">#getPorcentajeProteinasPlato</a>
|
|
97
|
+
|
|
98
|
+
<li ><a href="#method-i-getValorEnergeticoPlato">#getValorEnergeticoPlato</a>
|
|
99
|
+
|
|
100
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
|
101
|
+
|
|
102
|
+
</ul>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
</nav>
|
|
107
|
+
|
|
108
|
+
<main role="main" aria-labelledby="class-PlatoNutricional">
|
|
109
|
+
<h1 id="class-PlatoNutricional" class="class">
|
|
110
|
+
class PlatoNutricional
|
|
111
|
+
</h1>
|
|
112
|
+
|
|
113
|
+
<section class="description">
|
|
114
|
+
|
|
115
|
+
<p>Representa a un Plato con su nombre, formado por un conjunto de alimentos con sus respectivas cantidades. Esta clase encapsula métodos que utilizan valores energeticos. Cabe destacar, que el conjunto representa una abstración de una estructura enumerable como lo puede ser un Array o la clase <a href="Lista.html"><code>Lista</code></a></p>
|
|
116
|
+
|
|
117
|
+
</section>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
<section class="attribute-method-details" class="method-section">
|
|
129
|
+
<header>
|
|
130
|
+
<h3>Attributes</h3>
|
|
131
|
+
</header>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<div id="attribute-i-listaAlimentos" class="method-detail">
|
|
135
|
+
<div class="method-heading attribute-method-heading">
|
|
136
|
+
<span class="method-name">listaAlimentos</span><span
|
|
137
|
+
class="attribute-access-type">[R]</span>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div class="method-description">
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div id="attribute-i-listaCantidades" class="method-detail">
|
|
148
|
+
<div class="method-heading attribute-method-heading">
|
|
149
|
+
<span class="method-name">listaCantidades</span><span
|
|
150
|
+
class="attribute-access-type">[R]</span>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="method-description">
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div id="attribute-i-nombre" class="method-detail">
|
|
161
|
+
<div class="method-heading attribute-method-heading">
|
|
162
|
+
<span class="method-name">nombre</span><span
|
|
163
|
+
class="attribute-access-type">[R]</span>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div class="method-description">
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
</section>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
178
|
+
<header>
|
|
179
|
+
<h3>Public Class Methods</h3>
|
|
180
|
+
</header>
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<div id="method-c-new" class="method-detail ">
|
|
184
|
+
|
|
185
|
+
<div class="method-heading">
|
|
186
|
+
<span class="method-name">new</span><span
|
|
187
|
+
class="method-args">(nombre, listaAlimentos, listaCantidades)</span>
|
|
188
|
+
|
|
189
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
190
|
+
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<div class="method-description">
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<div class="method-source-code" id="new-source">
|
|
202
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 13</span>
|
|
203
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">nombre</span>, <span class="ruby-identifier">listaAlimentos</span>, <span class="ruby-identifier">listaCantidades</span>)
|
|
204
|
+
|
|
205
|
+
<span class="ruby-ivar">@nombre</span> = <span class="ruby-identifier">nombre</span>
|
|
206
|
+
<span class="ruby-ivar">@listaAlimentos</span> = <span class="ruby-identifier">listaAlimentos</span>
|
|
207
|
+
<span class="ruby-ivar">@listaCantidades</span> = <span class="ruby-identifier">listaCantidades</span>
|
|
208
|
+
|
|
209
|
+
<span class="ruby-keyword">end</span></pre>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
</section>
|
|
221
|
+
|
|
222
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
223
|
+
<header>
|
|
224
|
+
<h3>Public Instance Methods</h3>
|
|
225
|
+
</header>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<div id="method-i-3C-3D-3E" class="method-detail ">
|
|
229
|
+
|
|
230
|
+
<div class="method-heading">
|
|
231
|
+
<span class="method-name"><=></span><span
|
|
232
|
+
class="method-args">(other)</span>
|
|
233
|
+
|
|
234
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
235
|
+
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<div class="method-description">
|
|
240
|
+
|
|
241
|
+
<p>Compara dos Platos según su valor energético</p>
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
<div class="method-source-code" id="3C-3D-3E-source">
|
|
247
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 89</span>
|
|
248
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title"><=></span>(<span class="ruby-identifier">other</span>)
|
|
249
|
+
<span class="ruby-comment">#-1 si left < right</span>
|
|
250
|
+
<span class="ruby-comment"># 0 si left == right</span>
|
|
251
|
+
<span class="ruby-comment"># 1 si left > right</span>
|
|
252
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">getValorEnergeticoPlato</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">getValorEnergeticoPlato</span>
|
|
253
|
+
<span class="ruby-keyword">end</span></pre>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
<div id="method-i-3D-3D" class="method-detail ">
|
|
265
|
+
|
|
266
|
+
<div class="method-heading">
|
|
267
|
+
<span class="method-name">==</span><span
|
|
268
|
+
class="method-args">(other)</span>
|
|
269
|
+
|
|
270
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
271
|
+
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
<div class="method-description">
|
|
276
|
+
|
|
277
|
+
<p>Dos Platos son iguales si todos sus atributos lo son</p>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<div class="method-source-code" id="3D-3D-source">
|
|
283
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 97</span>
|
|
284
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">==</span>(<span class="ruby-identifier">other</span>)
|
|
285
|
+
(<span class="ruby-ivar">@nombre</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">nombre</span>) <span class="ruby-operator">&&</span> (<span class="ruby-ivar">@listaAlimentos</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">listaAlimentos</span>) <span class="ruby-operator">&&</span>
|
|
286
|
+
(<span class="ruby-ivar">@listaCantidades</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">listaCantidades</span>)
|
|
287
|
+
<span class="ruby-keyword">end</span></pre>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
<div id="method-i-getPorcentajeCarbohidratosPlato" class="method-detail ">
|
|
299
|
+
|
|
300
|
+
<div class="method-heading">
|
|
301
|
+
<span class="method-name">getPorcentajeCarbohidratosPlato</span><span
|
|
302
|
+
class="method-args">()</span>
|
|
303
|
+
|
|
304
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
305
|
+
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
<div class="method-description">
|
|
310
|
+
|
|
311
|
+
<p>Retorna el porcentaje que aporta los carbohidratos en el valor energético de un plato</p>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<div class="method-source-code" id="getPorcentajeCarbohidratosPlato-source">
|
|
317
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 51</span>
|
|
318
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">getPorcentajeCarbohidratosPlato</span>
|
|
319
|
+
|
|
320
|
+
<span class="ruby-identifier">carbohidratosTotales</span> = <span class="ruby-value">0</span>
|
|
321
|
+
|
|
322
|
+
<span class="ruby-ivar">@listaAlimentos</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alimento</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
|
323
|
+
<span class="ruby-identifier">carbohidratosTotales</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">alimento</span>.<span class="ruby-identifier">carbohidratos</span> <span class="ruby-operator">*</span> <span class="ruby-value">4.00</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@listaCantidades</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">index</span>)
|
|
324
|
+
<span class="ruby-keyword">end</span>
|
|
325
|
+
|
|
326
|
+
( (<span class="ruby-identifier">carbohidratosTotales</span> <span class="ruby-operator">*</span> <span class="ruby-value">100.00</span>) <span class="ruby-operator">/</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">getValorEnergeticoPlato</span> ).<span class="ruby-identifier">round</span>(<span class="ruby-value">2</span>)
|
|
327
|
+
|
|
328
|
+
<span class="ruby-keyword">end</span></pre>
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
<div id="method-i-getPorcentajeLipidosPlato" class="method-detail ">
|
|
340
|
+
|
|
341
|
+
<div class="method-heading">
|
|
342
|
+
<span class="method-name">getPorcentajeLipidosPlato</span><span
|
|
343
|
+
class="method-args">()</span>
|
|
344
|
+
|
|
345
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
346
|
+
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
<div class="method-description">
|
|
351
|
+
|
|
352
|
+
<p>Retorna el porcentaje que aporta los lípidos en el valor energético de un plato</p>
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
<div class="method-source-code" id="getPorcentajeLipidosPlato-source">
|
|
358
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 64</span>
|
|
359
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">getPorcentajeLipidosPlato</span>
|
|
360
|
+
|
|
361
|
+
<span class="ruby-identifier">lipidosTotales</span> = <span class="ruby-value">0</span>
|
|
362
|
+
|
|
363
|
+
<span class="ruby-ivar">@listaAlimentos</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alimento</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
|
364
|
+
<span class="ruby-identifier">lipidosTotales</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">alimento</span>.<span class="ruby-identifier">lipidos</span> <span class="ruby-operator">*</span> <span class="ruby-value">9.00</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@listaCantidades</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">index</span>)
|
|
365
|
+
<span class="ruby-keyword">end</span>
|
|
366
|
+
|
|
367
|
+
( (<span class="ruby-identifier">lipidosTotales</span> <span class="ruby-operator">*</span> <span class="ruby-value">100.00</span>) <span class="ruby-operator">/</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">getValorEnergeticoPlato</span> ).<span class="ruby-identifier">round</span>(<span class="ruby-value">2</span>)
|
|
368
|
+
|
|
369
|
+
<span class="ruby-keyword">end</span></pre>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
<div id="method-i-getPorcentajeProteinasPlato" class="method-detail ">
|
|
381
|
+
|
|
382
|
+
<div class="method-heading">
|
|
383
|
+
<span class="method-name">getPorcentajeProteinasPlato</span><span
|
|
384
|
+
class="method-args">()</span>
|
|
385
|
+
|
|
386
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
387
|
+
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
<div class="method-description">
|
|
392
|
+
|
|
393
|
+
<p>Retorna el porcentaje que aporta las porteinas en el valor energético de un plato</p>
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<div class="method-source-code" id="getPorcentajeProteinasPlato-source">
|
|
399
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 38</span>
|
|
400
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">getPorcentajeProteinasPlato</span>
|
|
401
|
+
|
|
402
|
+
<span class="ruby-identifier">proteinasTotales</span> = <span class="ruby-value">0</span>
|
|
403
|
+
|
|
404
|
+
<span class="ruby-ivar">@listaAlimentos</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alimento</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
|
405
|
+
<span class="ruby-identifier">proteinasTotales</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">alimento</span>.<span class="ruby-identifier">proteinas</span> <span class="ruby-operator">*</span> <span class="ruby-value">4.00</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@listaCantidades</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">index</span>)
|
|
406
|
+
<span class="ruby-keyword">end</span>
|
|
407
|
+
|
|
408
|
+
( (<span class="ruby-identifier">proteinasTotales</span> <span class="ruby-operator">*</span> <span class="ruby-value">100.00</span>) <span class="ruby-operator">/</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">getValorEnergeticoPlato</span> ).<span class="ruby-identifier">round</span>(<span class="ruby-value">2</span>)
|
|
409
|
+
|
|
410
|
+
<span class="ruby-keyword">end</span></pre>
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
</div>
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
<div id="method-i-getValorEnergeticoPlato" class="method-detail ">
|
|
422
|
+
|
|
423
|
+
<div class="method-heading">
|
|
424
|
+
<span class="method-name">getValorEnergeticoPlato</span><span
|
|
425
|
+
class="method-args">()</span>
|
|
426
|
+
|
|
427
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
428
|
+
|
|
429
|
+
</div>
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
<div class="method-description">
|
|
433
|
+
|
|
434
|
+
<p>Retorna el valor energético de un plato</p>
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<div class="method-source-code" id="getValorEnergeticoPlato-source">
|
|
440
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 22</span>
|
|
441
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">getValorEnergeticoPlato</span>
|
|
442
|
+
|
|
443
|
+
<span class="ruby-identifier">valorEnergeticoTotal</span> = <span class="ruby-value">0</span>
|
|
444
|
+
|
|
445
|
+
<span class="ruby-identifier">alimentoWithCantidad</span> = <span class="ruby-ivar">@listaAlimentos</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-ivar">@listaCantidades</span>)
|
|
446
|
+
|
|
447
|
+
<span class="ruby-identifier">alimentosMultiplicados</span> = <span class="ruby-identifier">alimentoWithCantidad</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">alimento</span>, <span class="ruby-identifier">cantidad</span><span class="ruby-operator">|</span>
|
|
448
|
+
<span class="ruby-identifier">alimento</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">cantidad</span>
|
|
449
|
+
<span class="ruby-keyword">end</span>
|
|
450
|
+
|
|
451
|
+
<span class="ruby-identifier">valorEnergeticoTotal</span> = <span class="ruby-identifier">alimentosMultiplicados</span>.<span class="ruby-identifier">reduce</span>(<span class="ruby-value">:+</span>).<span class="ruby-identifier">getValorEnergetico</span>
|
|
452
|
+
<span class="ruby-identifier">valorEnergeticoTotal</span>.<span class="ruby-identifier">round</span>(<span class="ruby-value">2</span>)
|
|
453
|
+
|
|
454
|
+
<span class="ruby-keyword">end</span></pre>
|
|
455
|
+
</div>
|
|
456
|
+
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
</div>
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
<div id="method-i-to_s" class="method-detail ">
|
|
466
|
+
|
|
467
|
+
<div class="method-heading">
|
|
468
|
+
<span class="method-name">to_s</span><span
|
|
469
|
+
class="method-args">()</span>
|
|
470
|
+
|
|
471
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
472
|
+
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
<div class="method-description">
|
|
477
|
+
|
|
478
|
+
<p>Retorna el Plato formateado</p>
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
<div class="method-source-code" id="to_s-source">
|
|
484
|
+
<pre><span class="ruby-comment"># File lib/huella/plato_nutricional.rb, line 77</span>
|
|
485
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
|
486
|
+
|
|
487
|
+
<span class="ruby-identifier">salida</span> = []
|
|
488
|
+
|
|
489
|
+
<span class="ruby-ivar">@listaAlimentos</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">elemento</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
|
490
|
+
<span class="ruby-identifier">salida</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"["</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">elemento</span>.<span class="ruby-identifier">nombre</span> <span class="ruby-operator">+</span> <span class="ruby-string">", "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@listaCantidades</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">index</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">"]"</span>
|
|
491
|
+
<span class="ruby-keyword">end</span>
|
|
492
|
+
|
|
493
|
+
<span class="ruby-string">"["</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@nombre</span> <span class="ruby-operator">+</span> <span class="ruby-string">" ["</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">salida</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">" "</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"]]"</span>
|
|
494
|
+
<span class="ruby-keyword">end</span></pre>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
</div>
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
</section>
|
|
506
|
+
|
|
507
|
+
</section>
|
|
508
|
+
|
|
509
|
+
</main>
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
<footer id="validator-badges" role="contentinfo">
|
|
513
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
|
514
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
|
515
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
516
|
+
</footer>
|
|
517
|
+
|
data/docs/README_md.html
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>README - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<script type="text/javascript">
|
|
10
|
+
var rdoc_rel_prefix = "./";
|
|
11
|
+
var index_rel_prefix = "./";
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script src="./js/jquery.js"></script>
|
|
15
|
+
<script src="./js/darkfish.js"></script>
|
|
16
|
+
|
|
17
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
|
18
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body id="top" role="document" class="file">
|
|
24
|
+
<nav role="navigation">
|
|
25
|
+
<div id="project-navigation">
|
|
26
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
27
|
+
<h2>
|
|
28
|
+
<a href="./index.html" rel="home">Home</a>
|
|
29
|
+
</h2>
|
|
30
|
+
|
|
31
|
+
<div id="table-of-contents-navigation">
|
|
32
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
|
33
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
34
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
39
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
40
|
+
<div id="search-field-wrapper">
|
|
41
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
42
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
43
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
44
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<ul id="search-results" aria-label="Search Results"
|
|
48
|
+
aria-busy="false" aria-expanded="false"
|
|
49
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
50
|
+
</form>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<div class="nav-section">
|
|
57
|
+
<h3>Table of Contents</h3>
|
|
58
|
+
|
|
59
|
+
<ul class="link-list" role="directory">
|
|
60
|
+
<li><a href="#label-T-C3-ADtulo-3A+Pr-C3-A1ctica+-23+6-2C+7-2C+8+y+9">Título: Práctica # 6, 7, 8 y 9</a>
|
|
61
|
+
<li><a href="#label-Huella">Huella</a>
|
|
62
|
+
<li><a href="#label-Installation">Installation</a>
|
|
63
|
+
<li><a href="#label-Usage">Usage</a>
|
|
64
|
+
<li><a href="#label-Development">Development</a>
|
|
65
|
+
<li><a href="#label-Contributing">Contributing</a>
|
|
66
|
+
</ul>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<div id="project-metadata">
|
|
71
|
+
<div id="fileindex-section" class="nav-section">
|
|
72
|
+
<h3>Pages</h3>
|
|
73
|
+
|
|
74
|
+
<ul class="link-list">
|
|
75
|
+
|
|
76
|
+
<li><a href="./Gemfile.html">Gemfile</a>
|
|
77
|
+
|
|
78
|
+
<li><a href="./Gemfile_lock.html">Gemfile.lock</a>
|
|
79
|
+
|
|
80
|
+
<li><a href="./Guardfile.html">Guardfile</a>
|
|
81
|
+
|
|
82
|
+
<li><a href="./README_md.html">README</a>
|
|
83
|
+
|
|
84
|
+
<li><a href="./Rakefile.html">Rakefile</a>
|
|
85
|
+
|
|
86
|
+
<li><a href="./bin/setup.html">setup</a>
|
|
87
|
+
|
|
88
|
+
<li><a href="./huella_gemspec.html">huella.gemspec</a>
|
|
89
|
+
|
|
90
|
+
</ul>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</nav>
|
|
95
|
+
|
|
96
|
+
<main role="main" aria-label="Page README.md">
|
|
97
|
+
|
|
98
|
+
<h1 id="label-T-C3-ADtulo-3A+Pr-C3-A1ctica+-23+6-2C+7-2C+8+y+9">Título: Práctica # 6, 7, 8 y 9<span><a href="#label-T-C3-ADtulo-3A+Pr-C3-A1ctica+-23+6-2C+7-2C+8+y+9">¶</a> <a href="#top">↑</a></span></h1>
|
|
99
|
+
|
|
100
|
+
<p><strong>Fecha:</strong> 18 de Diciembre del 2019<br> <strong>Alumno:</strong> Miguel Angel Ordoñez<br> <strong>Universidad:</strong> Universidad de La Laguna (ULL)<br> <strong>Grado:</strong> Ingeniería en Informática<br> <strong>Objetivo # 6:</strong> Crear un gema con Bundler y TDD<br> <strong>Objetivo # 7:</strong> Utilizar Guard y TDD con listas doblemente enlazadas<br> <strong>Objetivo # 8:</strong> Implementar Herencia y Módulos (Comparable y Enumerable)<br> <strong>Objetivo # 9:</strong> Paradigma de programación funcional</p>
|
|
101
|
+
|
|
102
|
+
<h1 id="label-Huella"><a href="Huella.html"><code>Huella</code></a><span><a href="#label-Huella">¶</a> <a href="#top">↑</a></span></h1>
|
|
103
|
+
|
|
104
|
+
<p>Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file <code>lib/huella</code>. To experiment with that code, run <code>bin/console</code> for an interactive prompt.</p>
|
|
105
|
+
|
|
106
|
+
<p>TODO: Delete this and the text above, and describe your gem</p>
|
|
107
|
+
|
|
108
|
+
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#top">↑</a></span></h2>
|
|
109
|
+
|
|
110
|
+
<p>Add this line to your application's Gemfile:</p>
|
|
111
|
+
|
|
112
|
+
<pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">'huella'</span>
|
|
113
|
+
</pre>
|
|
114
|
+
|
|
115
|
+
<p>And then execute:</p>
|
|
116
|
+
|
|
117
|
+
<pre>$ bundle</pre>
|
|
118
|
+
|
|
119
|
+
<p>Or install it yourself as:</p>
|
|
120
|
+
|
|
121
|
+
<pre>$ gem install huella</pre>
|
|
122
|
+
|
|
123
|
+
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#top">↑</a></span></h2>
|
|
124
|
+
|
|
125
|
+
<p>TODO: Write usage instructions here</p>
|
|
126
|
+
|
|
127
|
+
<h2 id="label-Development">Development<span><a href="#label-Development">¶</a> <a href="#top">↑</a></span></h2>
|
|
128
|
+
|
|
129
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
|
130
|
+
|
|
131
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
|
132
|
+
|
|
133
|
+
<h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">¶</a> <a href="#top">↑</a></span></h2>
|
|
134
|
+
|
|
135
|
+
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/ULL-ESIT-LPP-1920/tdd-miguel141097">github.com/ULL-ESIT-LPP-1920/tdd-miguel141097</a>.</p>
|
|
136
|
+
|
|
137
|
+
</main>
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<footer id="validator-badges" role="contentinfo">
|
|
142
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
|
143
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
|
144
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
145
|
+
</footer>
|
|
146
|
+
|