tddAlimentos 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 +13 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +101 -0
- data/Guardfile +83 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimento.html +428 -0
- data/docs/Gemfile.html +98 -0
- data/docs/Gemfile_lock.html +183 -0
- data/docs/Guardfile.html +166 -0
- data/docs/List.html +682 -0
- data/docs/Object.html +128 -0
- data/docs/Plato.html +607 -0
- data/docs/PlatoAmbiental.html +492 -0
- data/docs/README_md.html +126 -0
- data/docs/Rakefile.html +100 -0
- data/docs/TddAlimentos.html +110 -0
- data/docs/TddAlimentos/Error.html +103 -0
- data/docs/bin/setup.html +100 -0
- data/docs/created.rid +17 -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/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 +307 -0
- data/docs/tddAlimentos_gemspec.html +133 -0
- data/lib/tddAlimentos.rb +12 -0
- data/lib/tddAlimentos/alimento.rb +56 -0
- data/lib/tddAlimentos/lista.rb +172 -0
- data/lib/tddAlimentos/menu.rb +51 -0
- data/lib/tddAlimentos/plato.rb +125 -0
- data/lib/tddAlimentos/platoAmbiental.rb +108 -0
- data/lib/tddAlimentos/platoDSL.rb +94 -0
- data/lib/tddAlimentos/version.rb +3 -0
- data/tddAlimentos.gemspec +39 -0
- metadata +249 -0
@@ -0,0 +1,492 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class PlatoAmbiental - 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
|
+
<div class="nav-section">
|
57
|
+
<h3>Table of Contents</h3>
|
58
|
+
|
59
|
+
<ul class="link-list" role="directory">
|
60
|
+
<li><a href="#class-PlatoAmbiental-label-platoAmbiental.rb">platoAmbiental.rb</a>
|
61
|
+
<li><a href="#class-PlatoAmbiental-label-Descripci-C3-B3n">Descripción</a>
|
62
|
+
<li><a href="#class-PlatoAmbiental-label-M-C3-A9todos">Métodos</a>
|
63
|
+
</ul>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
<div id="class-metadata">
|
68
|
+
|
69
|
+
<div id="parent-class-section" class="nav-section">
|
70
|
+
<h3>Parent</h3>
|
71
|
+
|
72
|
+
|
73
|
+
<p class="link"><a href="Plato.html">Plato</a>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<!-- Method Quickref -->
|
80
|
+
<div id="method-list-section" class="nav-section">
|
81
|
+
<h3>Methods</h3>
|
82
|
+
|
83
|
+
<ul class="link-list" role="directory">
|
84
|
+
|
85
|
+
<li class="calls-super" ><a href="#method-c-new">::new</a>
|
86
|
+
|
87
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
88
|
+
|
89
|
+
<li ><a href="#method-i-calc_gei">#calc_gei</a>
|
90
|
+
|
91
|
+
<li ><a href="#method-i-calc_terrain">#calc_terrain</a>
|
92
|
+
|
93
|
+
<li ><a href="#method-i-nutritional_footprint">#nutritional_footprint</a>
|
94
|
+
|
95
|
+
<li class="calls-super" ><a href="#method-i-to_s">#to_s</a>
|
96
|
+
|
97
|
+
</ul>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
</nav>
|
102
|
+
|
103
|
+
<main role="main" aria-labelledby="class-PlatoAmbiental">
|
104
|
+
<h1 id="class-PlatoAmbiental" class="class">
|
105
|
+
class PlatoAmbiental
|
106
|
+
</h1>
|
107
|
+
|
108
|
+
<section class="description">
|
109
|
+
|
110
|
+
<h1 id="class-PlatoAmbiental-label-platoAmbiental.rb">platoAmbiental.rb<span><a href="#class-PlatoAmbiental-label-platoAmbiental.rb">¶</a> <a href="#top">↑</a></span></h1>
|
111
|
+
<dl class="rdoc-list note-list"><dt>Autor
|
112
|
+
<dd>
|
113
|
+
<p>Himar Manuel Barquín Carrasco</p>
|
114
|
+
</dd><dt>Web
|
115
|
+
<dd>
|
116
|
+
<p><a href="https://github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373">github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373</a></p>
|
117
|
+
</dd></dl>
|
118
|
+
|
119
|
+
<h2 id="class-PlatoAmbiental-label-Descripci-C3-B3n">Descripción<span><a href="#class-PlatoAmbiental-label-Descripci-C3-B3n">¶</a> <a href="#top">↑</a></span></h2>
|
120
|
+
|
121
|
+
<p>Clase que hereda de la clase <a href="Plato.html"><code>Plato</code></a>, y que incorpora los atributos gei y terreno, que nos informan de los gases de efecto invernadero y el terreno en metros cuadrados que son necesarios para producir este plato</p>
|
122
|
+
|
123
|
+
<h2 id="class-PlatoAmbiental-label-M-C3-A9todos">Métodos<span><a href="#class-PlatoAmbiental-label-M-C3-A9todos">¶</a> <a href="#top">↑</a></span></h2>
|
124
|
+
<ul><li>
|
125
|
+
<p><a href="PlatoAmbiental.html#method-i-to_s"><code>to_s</code></a></p>
|
126
|
+
</li><li>
|
127
|
+
<p>calc_vct</p>
|
128
|
+
</li><li>
|
129
|
+
<p><a href="PlatoAmbiental.html#method-i-nutritional_footprint"><code>nutritional_footprint</code></a></p>
|
130
|
+
</li><li>
|
131
|
+
<p><a href="PlatoAmbiental.html#method-i-calc_gei"><code>calc_gei</code></a></p>
|
132
|
+
</li><li>
|
133
|
+
<p><a href="PlatoAmbiental.html#method-i-calc_terrain"><code>calc_terrain</code></a></p>
|
134
|
+
</li><li>
|
135
|
+
<p><=></p>
|
136
|
+
</li></ul>
|
137
|
+
|
138
|
+
</section>
|
139
|
+
|
140
|
+
|
141
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<section class="attribute-method-details" class="method-section">
|
150
|
+
<header>
|
151
|
+
<h3>Attributes</h3>
|
152
|
+
</header>
|
153
|
+
|
154
|
+
|
155
|
+
<div id="attribute-i-gei" class="method-detail">
|
156
|
+
<div class="method-heading attribute-method-heading">
|
157
|
+
<span class="method-name">gei</span><span
|
158
|
+
class="attribute-access-type">[R]</span>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="attribute-i-terrain" class="method-detail">
|
169
|
+
<div class="method-heading attribute-method-heading">
|
170
|
+
<span class="method-name">terrain</span><span
|
171
|
+
class="attribute-access-type">[R]</span>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="method-description">
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
</section>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
186
|
+
<header>
|
187
|
+
<h3>Public Class Methods</h3>
|
188
|
+
</header>
|
189
|
+
|
190
|
+
|
191
|
+
<div id="method-c-new" class="method-detail ">
|
192
|
+
|
193
|
+
<div class="method-heading">
|
194
|
+
<span class="method-name">new</span><span
|
195
|
+
class="method-args">(name, alimentos = [], gramos = [])</span>
|
196
|
+
|
197
|
+
<span class="method-click-advice">click to toggle source</span>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
<div class="method-description">
|
203
|
+
|
204
|
+
<p>Constructor de la clase <a href="PlatoAmbiental.html"><code>PlatoAmbiental</code></a></p>
|
205
|
+
<dl class="rdoc-list note-list"><dt>Parámetros
|
206
|
+
<dd></dd></dl>
|
207
|
+
<ul><li>
|
208
|
+
<p>name: Nombre del plato</p>
|
209
|
+
</li><li>
|
210
|
+
<p>alimentos: Conjunto de alimentos que componen el plato</p>
|
211
|
+
</li><li>
|
212
|
+
<p>gramos: Cantidades en gramos de cada alimento del plato</p>
|
213
|
+
</li></ul>
|
214
|
+
|
215
|
+
|
216
|
+
<div class="method-calls-super">
|
217
|
+
Calls superclass method
|
218
|
+
<a href="Plato.html#method-c-new"><code>Plato::new</code></a>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
<div class="method-source-code" id="new-source">
|
224
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/platoAmbiental.rb, line 28</span>
|
225
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span> (<span class="ruby-identifier">name</span>, <span class="ruby-identifier">alimentos</span> = [], <span class="ruby-identifier">gramos</span> = [])
|
226
|
+
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">alimentos</span>, <span class="ruby-identifier">gramos</span>)
|
227
|
+
|
228
|
+
<span class="ruby-ivar">@gei</span> = <span class="ruby-identifier">calc_gei</span>
|
229
|
+
<span class="ruby-ivar">@terrain</span> = <span class="ruby-identifier">calc_terrain</span>
|
230
|
+
<span class="ruby-keyword">end</span></pre>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
</div>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
</section>
|
242
|
+
|
243
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
244
|
+
<header>
|
245
|
+
<h3>Public Instance Methods</h3>
|
246
|
+
</header>
|
247
|
+
|
248
|
+
|
249
|
+
<div id="method-i-3C-3D-3E" class="method-detail ">
|
250
|
+
|
251
|
+
<div class="method-heading">
|
252
|
+
<span class="method-name"><=></span><span
|
253
|
+
class="method-args">(another)</span>
|
254
|
+
|
255
|
+
<span class="method-click-advice">click to toggle source</span>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
<div class="method-description">
|
261
|
+
|
262
|
+
<p>Permite la comparación de dos 'platos ambientales' mediante la huella nutricional</p>
|
263
|
+
<dl class="rdoc-list note-list"><dt>Parámetros
|
264
|
+
<dd></dd></dl>
|
265
|
+
<ul><li>
|
266
|
+
<p>another: objeto <a href="PlatoAmbiental.html"><code>PlatoAmbiental</code></a> que comparar con el objeto invocante</p>
|
267
|
+
</li></ul>
|
268
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
269
|
+
<dd>
|
270
|
+
<p>'true' si la comparación es verdadera. 'false' en otro caso</p>
|
271
|
+
</dd></dl>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
<div class="method-source-code" id="3C-3D-3E-source">
|
277
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/platoAmbiental.rb, line 104</span>
|
278
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title"><=></span> (<span class="ruby-identifier">another</span>)
|
279
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">nutritional_footprint</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">another</span>.<span class="ruby-identifier">nutritional_footprint</span>
|
280
|
+
<span class="ruby-keyword">end</span></pre>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
</div>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
</div>
|
289
|
+
|
290
|
+
|
291
|
+
<div id="method-i-calc_gei" class="method-detail ">
|
292
|
+
|
293
|
+
<div class="method-heading">
|
294
|
+
<span class="method-name">calc_gei</span><span
|
295
|
+
class="method-args">()</span>
|
296
|
+
|
297
|
+
<span class="method-click-advice">click to toggle source</span>
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
|
302
|
+
<div class="method-description">
|
303
|
+
|
304
|
+
<p>Calcula el gas de efecto invernadero que se produce al crear el plato</p>
|
305
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
306
|
+
<dd>
|
307
|
+
<p>GEI del plato</p>
|
308
|
+
</dd></dl>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
<div class="method-source-code" id="calc_gei-source">
|
314
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/platoAmbiental.rb, line 74</span>
|
315
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">calc_gei</span>
|
316
|
+
<span class="ruby-identifier">datos</span> = <span class="ruby-ivar">@food</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gei</span> }
|
317
|
+
<span class="ruby-identifier">gramos</span> = <span class="ruby-ivar">@quantities</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span><span class="ruby-operator">/</span><span class="ruby-value">100.0</span> }
|
318
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">0.0</span>
|
319
|
+
|
320
|
+
<span class="ruby-keyword">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword">in</span> <span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">datos</span>.<span class="ruby-identifier">size</span>
|
321
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">datos</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">gramos</span>[<span class="ruby-identifier">i</span>]
|
322
|
+
<span class="ruby-keyword">end</span>
|
323
|
+
<span class="ruby-identifier">result</span>
|
324
|
+
<span class="ruby-keyword">end</span></pre>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
</div>
|
333
|
+
|
334
|
+
|
335
|
+
<div id="method-i-calc_terrain" class="method-detail ">
|
336
|
+
|
337
|
+
<div class="method-heading">
|
338
|
+
<span class="method-name">calc_terrain</span><span
|
339
|
+
class="method-args">()</span>
|
340
|
+
|
341
|
+
<span class="method-click-advice">click to toggle source</span>
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
<div class="method-description">
|
347
|
+
|
348
|
+
<p>Calcula el terreno consumido por la producción del plato</p>
|
349
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
350
|
+
<dd>
|
351
|
+
<p>Valor del terreno</p>
|
352
|
+
</dd></dl>
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
<div class="method-source-code" id="calc_terrain-source">
|
358
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/platoAmbiental.rb, line 88</span>
|
359
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">calc_terrain</span>
|
360
|
+
<span class="ruby-identifier">datos</span> = <span class="ruby-ivar">@food</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">terrain</span> }
|
361
|
+
<span class="ruby-identifier">gramos</span> = <span class="ruby-ivar">@quantities</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span><span class="ruby-operator">/</span><span class="ruby-value">100.0</span> }
|
362
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">0.0</span>
|
363
|
+
|
364
|
+
<span class="ruby-keyword">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword">in</span> <span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">datos</span>.<span class="ruby-identifier">size</span>
|
365
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">datos</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">gramos</span>[<span class="ruby-identifier">i</span>]
|
366
|
+
<span class="ruby-keyword">end</span>
|
367
|
+
<span class="ruby-identifier">result</span>
|
368
|
+
<span class="ruby-keyword">end</span></pre>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</div>
|
377
|
+
|
378
|
+
|
379
|
+
<div id="method-i-nutritional_footprint" class="method-detail ">
|
380
|
+
|
381
|
+
<div class="method-heading">
|
382
|
+
<span class="method-name">nutritional_footprint</span><span
|
383
|
+
class="method-args">()</span>
|
384
|
+
|
385
|
+
<span class="method-click-advice">click to toggle source</span>
|
386
|
+
|
387
|
+
</div>
|
388
|
+
|
389
|
+
|
390
|
+
<div class="method-description">
|
391
|
+
|
392
|
+
<p>Calcula la huella nutricional del plato</p>
|
393
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
394
|
+
<dd>
|
395
|
+
<p>Valor de la huella nutricional</p>
|
396
|
+
</dd></dl>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
<div class="method-source-code" id="nutritional_footprint-source">
|
402
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/platoAmbiental.rb, line 49</span>
|
403
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">nutritional_footprint</span>
|
404
|
+
<span class="ruby-identifier">kcal_impact</span> = <span class="ruby-value">0</span>
|
405
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@vct</span> <span class="ruby-operator"><</span> <span class="ruby-value">670</span>
|
406
|
+
<span class="ruby-identifier">kcal_impact</span> = <span class="ruby-value">1</span>
|
407
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@vct</span> <span class="ruby-operator">></span> <span class="ruby-value">830</span>
|
408
|
+
<span class="ruby-identifier">kcal_impact</span> = <span class="ruby-value">3</span>
|
409
|
+
<span class="ruby-keyword">else</span>
|
410
|
+
<span class="ruby-identifier">kcal_impact</span> = <span class="ruby-value">2</span>
|
411
|
+
<span class="ruby-keyword">end</span>
|
412
|
+
|
413
|
+
<span class="ruby-identifier">gei_impact</span> = <span class="ruby-value">0</span>
|
414
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@gei</span> <span class="ruby-operator"><</span> <span class="ruby-value">800</span>
|
415
|
+
<span class="ruby-identifier">gei_impact</span> = <span class="ruby-value">1</span>
|
416
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@gei</span> <span class="ruby-operator">></span> <span class="ruby-value">1200</span>
|
417
|
+
<span class="ruby-identifier">gei_impact</span> = <span class="ruby-value">3</span>
|
418
|
+
<span class="ruby-keyword">else</span>
|
419
|
+
<span class="ruby-identifier">gei_impact</span> = <span class="ruby-value">2</span>
|
420
|
+
<span class="ruby-keyword">end</span>
|
421
|
+
|
422
|
+
(<span class="ruby-identifier">kcal_impact</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">gei_impact</span>) <span class="ruby-operator">/</span> <span class="ruby-value">2.0</span>
|
423
|
+
<span class="ruby-keyword">end</span></pre>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
</div>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</div>
|
432
|
+
|
433
|
+
|
434
|
+
<div id="method-i-to_s" class="method-detail ">
|
435
|
+
|
436
|
+
<div class="method-heading">
|
437
|
+
<span class="method-name">to_s</span><span
|
438
|
+
class="method-args">()</span>
|
439
|
+
|
440
|
+
<span class="method-click-advice">click to toggle source</span>
|
441
|
+
|
442
|
+
</div>
|
443
|
+
|
444
|
+
|
445
|
+
<div class="method-description">
|
446
|
+
|
447
|
+
<p>Imprime la información de la clase <a href="Plato.html"><code>Plato</code></a> y le añade la información del GEI y el terreno</p>
|
448
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
449
|
+
<dd>
|
450
|
+
<p>Cadena de texto con la información del plato de la clase <a href="Plato.html"><code>Plato</code></a> y la información del GEI y el terreno</p>
|
451
|
+
</dd></dl>
|
452
|
+
|
453
|
+
|
454
|
+
<div class="method-calls-super">
|
455
|
+
Calls superclass method
|
456
|
+
<a href="Plato.html#method-i-to_s"><code>Plato#to_s</code></a>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
<div class="method-source-code" id="to_s-source">
|
462
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/platoAmbiental.rb, line 38</span>
|
463
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
464
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-string">""</span>
|
465
|
+
|
466
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-keyword">super</span>.<span class="ruby-identifier">to_s</span>
|
467
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"\nGEI: #{@gei.round(2)} kgCO2eq"</span>
|
468
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"\nTerreno: #{@terrain.round(2)} m2 / año"</span>
|
469
|
+
<span class="ruby-keyword">end</span></pre>
|
470
|
+
</div>
|
471
|
+
|
472
|
+
</div>
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
</div>
|
478
|
+
|
479
|
+
|
480
|
+
</section>
|
481
|
+
|
482
|
+
</section>
|
483
|
+
|
484
|
+
</main>
|
485
|
+
|
486
|
+
|
487
|
+
<footer id="validator-badges" role="contentinfo">
|
488
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
489
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
490
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
491
|
+
</footer>
|
492
|
+
|