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
data/docs/Object.html
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Object - 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">BasicObject
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</div>
|
71
|
+
</nav>
|
72
|
+
|
73
|
+
<main role="main" aria-labelledby="class-Object">
|
74
|
+
<h1 id="class-Object" class="class">
|
75
|
+
class Object
|
76
|
+
</h1>
|
77
|
+
|
78
|
+
<section class="description">
|
79
|
+
|
80
|
+
</section>
|
81
|
+
|
82
|
+
|
83
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<section class="constants-list">
|
90
|
+
<header>
|
91
|
+
<h3>Constants</h3>
|
92
|
+
</header>
|
93
|
+
<dl>
|
94
|
+
|
95
|
+
<dt id="Node">Node
|
96
|
+
|
97
|
+
<dd><h1 id="label-Node"><a href="Object.html#Node"><code>Node</code></a><span><a href="#label-Node">¶</a> <a href="#top">↑</a></span></h1>
|
98
|
+
<dl class="rdoc-list note-list"><dt>Autor
|
99
|
+
<dd>
|
100
|
+
<p>Himar Manuel Barquín Carrasco</p>
|
101
|
+
</dd><dt>Web
|
102
|
+
<dd>
|
103
|
+
<p><a href="https://github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373">github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373</a></p>
|
104
|
+
</dd></dl>
|
105
|
+
|
106
|
+
<h2 id="label-Descripci-C3-B3n">Descripción<span><a href="#label-Descripci-C3-B3n">¶</a> <a href="#top">↑</a></span></h2>
|
107
|
+
|
108
|
+
<p>Estructura que representa un nodo. Contiene la información del valor que almacena, el nodo siguiente y el nodo previo</p>
|
109
|
+
|
110
|
+
|
111
|
+
</dl>
|
112
|
+
</section>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
</section>
|
119
|
+
|
120
|
+
</main>
|
121
|
+
|
122
|
+
|
123
|
+
<footer id="validator-badges" role="contentinfo">
|
124
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
125
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
126
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
127
|
+
</footer>
|
128
|
+
|
data/docs/Plato.html
ADDED
@@ -0,0 +1,607 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Plato - 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-Plato-label-plato.rb">plato.rb</a>
|
61
|
+
<li><a href="#class-Plato-label-Descripci-C3-B3n">Descripción</a>
|
62
|
+
<li><a href="#class-Plato-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="Object.html">Object</a>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div id="includes-section" class="nav-section">
|
78
|
+
<h3>Included Modules</h3>
|
79
|
+
|
80
|
+
<ul class="link-list">
|
81
|
+
|
82
|
+
|
83
|
+
<li><span class="include">Comparable</span>
|
84
|
+
|
85
|
+
|
86
|
+
</ul>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- Method Quickref -->
|
91
|
+
<div id="method-list-section" class="nav-section">
|
92
|
+
<h3>Methods</h3>
|
93
|
+
|
94
|
+
<ul class="link-list" role="directory">
|
95
|
+
|
96
|
+
<li ><a href="#method-c-new">::new</a>
|
97
|
+
|
98
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
99
|
+
|
100
|
+
<li ><a href="#method-i-calc_perc_carbohydrates">#calc_perc_carbohydrates</a>
|
101
|
+
|
102
|
+
<li ><a href="#method-i-calc_perc_lipids">#calc_perc_lipids</a>
|
103
|
+
|
104
|
+
<li ><a href="#method-i-calc_perc_proteins">#calc_perc_proteins</a>
|
105
|
+
|
106
|
+
<li ><a href="#method-i-calc_vct">#calc_vct</a>
|
107
|
+
|
108
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
109
|
+
|
110
|
+
</ul>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</nav>
|
115
|
+
|
116
|
+
<main role="main" aria-labelledby="class-Plato">
|
117
|
+
<h1 id="class-Plato" class="class">
|
118
|
+
class Plato
|
119
|
+
</h1>
|
120
|
+
|
121
|
+
<section class="description">
|
122
|
+
|
123
|
+
<h1 id="class-Plato-label-plato.rb">plato.rb<span><a href="#class-Plato-label-plato.rb">¶</a> <a href="#top">↑</a></span></h1>
|
124
|
+
<dl class="rdoc-list note-list"><dt>Autor
|
125
|
+
<dd>
|
126
|
+
<p>Himar Manuel Barquín Carrasco</p>
|
127
|
+
</dd><dt>Web
|
128
|
+
<dd>
|
129
|
+
<p><a href="https://github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373">github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373</a></p>
|
130
|
+
</dd></dl>
|
131
|
+
|
132
|
+
<h2 id="class-Plato-label-Descripci-C3-B3n">Descripción<span><a href="#class-Plato-label-Descripci-C3-B3n">¶</a> <a href="#top">↑</a></span></h2>
|
133
|
+
|
134
|
+
<p>Clase que contiene una lista de alimentos, con sus cantidades. Además, nos informa del porcentaje de proteínas, lípidos y carbohidratos en proporción a las kilocalorías totales del plato.</p>
|
135
|
+
|
136
|
+
<h2 id="class-Plato-label-M-C3-A9todos">Métodos<span><a href="#class-Plato-label-M-C3-A9todos">¶</a> <a href="#top">↑</a></span></h2>
|
137
|
+
<ul><li>
|
138
|
+
<p><a href="Plato.html#method-i-to_s"><code>to_s</code></a></p>
|
139
|
+
</li><li>
|
140
|
+
<p><a href="Plato.html#method-i-calc_vct"><code>calc_vct</code></a></p>
|
141
|
+
</li><li>
|
142
|
+
<p><a href="Plato.html#method-i-calc_perc_proteins"><code>calc_perc_proteins</code></a></p>
|
143
|
+
</li><li>
|
144
|
+
<p><a href="Plato.html#method-i-calc_perc_lipids"><code>calc_perc_lipids</code></a></p>
|
145
|
+
</li><li>
|
146
|
+
<p><a href="Plato.html#method-i-calc_perc_carbohydrates"><code>calc_perc_carbohydrates</code></a></p>
|
147
|
+
</li><li>
|
148
|
+
<p><=></p>
|
149
|
+
</li></ul>
|
150
|
+
|
151
|
+
</section>
|
152
|
+
|
153
|
+
|
154
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<section class="attribute-method-details" class="method-section">
|
163
|
+
<header>
|
164
|
+
<h3>Attributes</h3>
|
165
|
+
</header>
|
166
|
+
|
167
|
+
|
168
|
+
<div id="attribute-i-food" class="method-detail">
|
169
|
+
<div class="method-heading attribute-method-heading">
|
170
|
+
<span class="method-name">food</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
|
+
<div id="attribute-i-name" class="method-detail">
|
182
|
+
<div class="method-heading attribute-method-heading">
|
183
|
+
<span class="method-name">name</span><span
|
184
|
+
class="attribute-access-type">[R]</span>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div id="attribute-i-percentage_carbohydrates" class="method-detail">
|
195
|
+
<div class="method-heading attribute-method-heading">
|
196
|
+
<span class="method-name">percentage_carbohydrates</span><span
|
197
|
+
class="attribute-access-type">[R]</span>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="attribute-i-percentage_lipids" class="method-detail">
|
208
|
+
<div class="method-heading attribute-method-heading">
|
209
|
+
<span class="method-name">percentage_lipids</span><span
|
210
|
+
class="attribute-access-type">[R]</span>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<div id="attribute-i-percentage_proteins" class="method-detail">
|
221
|
+
<div class="method-heading attribute-method-heading">
|
222
|
+
<span class="method-name">percentage_proteins</span><span
|
223
|
+
class="attribute-access-type">[R]</span>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div class="method-description">
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="attribute-i-quantities" class="method-detail">
|
234
|
+
<div class="method-heading attribute-method-heading">
|
235
|
+
<span class="method-name">quantities</span><span
|
236
|
+
class="attribute-access-type">[R]</span>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="method-description">
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
|
246
|
+
<div id="attribute-i-vct" class="method-detail">
|
247
|
+
<div class="method-heading attribute-method-heading">
|
248
|
+
<span class="method-name">vct</span><span
|
249
|
+
class="attribute-access-type">[R]</span>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div class="method-description">
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</div>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</section>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
264
|
+
<header>
|
265
|
+
<h3>Public Class Methods</h3>
|
266
|
+
</header>
|
267
|
+
|
268
|
+
|
269
|
+
<div id="method-c-new" class="method-detail ">
|
270
|
+
|
271
|
+
<div class="method-heading">
|
272
|
+
<span class="method-name">new</span><span
|
273
|
+
class="method-args">(name, alimentos = [], gramos = [])</span>
|
274
|
+
|
275
|
+
<span class="method-click-advice">click to toggle source</span>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
|
280
|
+
<div class="method-description">
|
281
|
+
|
282
|
+
<p>Constructor de la clase <a href="Plato.html"><code>Plato</code></a></p>
|
283
|
+
<dl class="rdoc-list note-list"><dt>Parámetros
|
284
|
+
<dd></dd></dl>
|
285
|
+
<ul><li>
|
286
|
+
<p>name: Nombre del plato</p>
|
287
|
+
</li><li>
|
288
|
+
<p>alimentos: Conjunto de alimentos que componen el plato</p>
|
289
|
+
</li><li>
|
290
|
+
<p>gramos: Cantidades en gramos de cada alimento del plato</p>
|
291
|
+
</li></ul>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
<div class="method-source-code" id="new-source">
|
297
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 29</span>
|
298
|
+
<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> = [])
|
299
|
+
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
300
|
+
|
301
|
+
<span class="ruby-ivar">@food</span> = <span class="ruby-constant">List</span>.<span class="ruby-identifier">new</span>
|
302
|
+
<span class="ruby-ivar">@food</span>.<span class="ruby-identifier">insert_more</span>(<span class="ruby-identifier">alimentos</span>)
|
303
|
+
|
304
|
+
<span class="ruby-ivar">@quantities</span> = <span class="ruby-constant">List</span>.<span class="ruby-identifier">new</span>
|
305
|
+
<span class="ruby-ivar">@quantities</span>.<span class="ruby-identifier">insert_more</span>(<span class="ruby-identifier">gramos</span>)
|
306
|
+
|
307
|
+
<span class="ruby-ivar">@vct</span> = <span class="ruby-identifier">calc_vct</span>
|
308
|
+
|
309
|
+
<span class="ruby-comment"># Calculamos los porcentajes</span>
|
310
|
+
<span class="ruby-ivar">@percentage_proteins</span> = <span class="ruby-identifier">calc_perc_proteins</span>
|
311
|
+
<span class="ruby-ivar">@percentage_lipids</span> = <span class="ruby-identifier">calc_perc_lipids</span>
|
312
|
+
<span class="ruby-ivar">@percentage_carbohydrates</span> = <span class="ruby-identifier">calc_perc_carbohydrates</span>
|
313
|
+
<span class="ruby-keyword">end</span></pre>
|
314
|
+
</div>
|
315
|
+
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
|
324
|
+
</section>
|
325
|
+
|
326
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
327
|
+
<header>
|
328
|
+
<h3>Public Instance Methods</h3>
|
329
|
+
</header>
|
330
|
+
|
331
|
+
|
332
|
+
<div id="method-i-3C-3D-3E" class="method-detail ">
|
333
|
+
|
334
|
+
<div class="method-heading">
|
335
|
+
<span class="method-name"><=></span><span
|
336
|
+
class="method-args">(another)</span>
|
337
|
+
|
338
|
+
<span class="method-click-advice">click to toggle source</span>
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
|
343
|
+
<div class="method-description">
|
344
|
+
|
345
|
+
<p>Nos permite comparar platos por su Valor Calórico Total</p>
|
346
|
+
<dl class="rdoc-list note-list"><dt>Parámetros
|
347
|
+
<dd></dd></dl>
|
348
|
+
<ul><li>
|
349
|
+
<p>another: Otro plato que se compara con el invocante</p>
|
350
|
+
</li></ul>
|
351
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
352
|
+
<dd>
|
353
|
+
<p>'true' si la comparación es verdadera. 'false' en otro caso</p>
|
354
|
+
</dd></dl>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
<div class="method-source-code" id="3C-3D-3E-source">
|
360
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 122</span>
|
361
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title"><=></span> (<span class="ruby-identifier">another</span>)
|
362
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">vct</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">another</span>.<span class="ruby-identifier">vct</span>
|
363
|
+
<span class="ruby-keyword">end</span></pre>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
<div id="method-i-calc_perc_carbohydrates" class="method-detail ">
|
375
|
+
|
376
|
+
<div class="method-heading">
|
377
|
+
<span class="method-name">calc_perc_carbohydrates</span><span
|
378
|
+
class="method-args">()</span>
|
379
|
+
|
380
|
+
<span class="method-click-advice">click to toggle source</span>
|
381
|
+
|
382
|
+
</div>
|
383
|
+
|
384
|
+
|
385
|
+
<div class="method-description">
|
386
|
+
|
387
|
+
<p>Calcula el porcentaje de carbohidratos del plato</p>
|
388
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
389
|
+
<dd>
|
390
|
+
<p>Porcentaje de carbohidratos</p>
|
391
|
+
</dd></dl>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
<div class="method-source-code" id="calc_perc_carbohydrates-source">
|
397
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 106</span>
|
398
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">calc_perc_carbohydrates</span>
|
399
|
+
<span class="ruby-identifier">alimentos</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">carbohydrates</span> }
|
400
|
+
<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> }
|
401
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">0.0</span>
|
402
|
+
|
403
|
+
<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">alimentos</span>.<span class="ruby-identifier">size</span>
|
404
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">gramos</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">alimentos</span>[<span class="ruby-identifier">i</span>]) <span class="ruby-operator">*</span> <span class="ruby-value">4</span>
|
405
|
+
<span class="ruby-keyword">end</span>
|
406
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">/=</span> <span class="ruby-ivar">@vct</span>
|
407
|
+
<span class="ruby-keyword">end</span></pre>
|
408
|
+
</div>
|
409
|
+
|
410
|
+
</div>
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
</div>
|
416
|
+
|
417
|
+
|
418
|
+
<div id="method-i-calc_perc_lipids" class="method-detail ">
|
419
|
+
|
420
|
+
<div class="method-heading">
|
421
|
+
<span class="method-name">calc_perc_lipids</span><span
|
422
|
+
class="method-args">()</span>
|
423
|
+
|
424
|
+
<span class="method-click-advice">click to toggle source</span>
|
425
|
+
|
426
|
+
</div>
|
427
|
+
|
428
|
+
|
429
|
+
<div class="method-description">
|
430
|
+
|
431
|
+
<p>Calcula el porcentaje de lípidos del plato</p>
|
432
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
433
|
+
<dd>
|
434
|
+
<p>Porcentaje de lípidos</p>
|
435
|
+
</dd></dl>
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
<div class="method-source-code" id="calc_perc_lipids-source">
|
441
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 92</span>
|
442
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">calc_perc_lipids</span>
|
443
|
+
<span class="ruby-identifier">alimentos</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">lipids</span> }
|
444
|
+
<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> }
|
445
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">0.0</span>
|
446
|
+
|
447
|
+
<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">alimentos</span>.<span class="ruby-identifier">size</span>
|
448
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">gramos</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">alimentos</span>[<span class="ruby-identifier">i</span>]) <span class="ruby-operator">*</span> <span class="ruby-value">9</span>
|
449
|
+
<span class="ruby-keyword">end</span>
|
450
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">/=</span> <span class="ruby-ivar">@vct</span>
|
451
|
+
<span class="ruby-keyword">end</span></pre>
|
452
|
+
</div>
|
453
|
+
|
454
|
+
</div>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
</div>
|
460
|
+
|
461
|
+
|
462
|
+
<div id="method-i-calc_perc_proteins" class="method-detail ">
|
463
|
+
|
464
|
+
<div class="method-heading">
|
465
|
+
<span class="method-name">calc_perc_proteins</span><span
|
466
|
+
class="method-args">()</span>
|
467
|
+
|
468
|
+
<span class="method-click-advice">click to toggle source</span>
|
469
|
+
|
470
|
+
</div>
|
471
|
+
|
472
|
+
|
473
|
+
<div class="method-description">
|
474
|
+
|
475
|
+
<p>Calcula el porcetaje de proteínas del plato</p>
|
476
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
477
|
+
<dd>
|
478
|
+
<p>Porcentaje de proteínas</p>
|
479
|
+
</dd></dl>
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
<div class="method-source-code" id="calc_perc_proteins-source">
|
485
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 78</span>
|
486
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">calc_perc_proteins</span>
|
487
|
+
<span class="ruby-identifier">alimentos</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">protein</span> }
|
488
|
+
<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> }
|
489
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">0.0</span>
|
490
|
+
|
491
|
+
<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">alimentos</span>.<span class="ruby-identifier">size</span>
|
492
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">gramos</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">alimentos</span>[<span class="ruby-identifier">i</span>]) <span class="ruby-operator">*</span> <span class="ruby-value">4</span>
|
493
|
+
<span class="ruby-keyword">end</span>
|
494
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">/=</span> <span class="ruby-ivar">@vct</span>
|
495
|
+
<span class="ruby-keyword">end</span></pre>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
</div>
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
</div>
|
504
|
+
|
505
|
+
|
506
|
+
<div id="method-i-calc_vct" class="method-detail ">
|
507
|
+
|
508
|
+
<div class="method-heading">
|
509
|
+
<span class="method-name">calc_vct</span><span
|
510
|
+
class="method-args">()</span>
|
511
|
+
|
512
|
+
<span class="method-click-advice">click to toggle source</span>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
<div class="method-description">
|
518
|
+
|
519
|
+
<p>Calcula el Valor Calórico Total del plato</p>
|
520
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
521
|
+
<dd>
|
522
|
+
<p>Valor Calórico Total del plato</p>
|
523
|
+
</dd></dl>
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
<div class="method-source-code" id="calc_vct-source">
|
529
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 64</span>
|
530
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">calc_vct</span>
|
531
|
+
<span class="ruby-identifier">alimentos</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">energetic_value</span> }
|
532
|
+
<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> }
|
533
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-value">0.0</span>
|
534
|
+
|
535
|
+
<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">alimentos</span>.<span class="ruby-identifier">size</span>
|
536
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">gramos</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">alimentos</span>[<span class="ruby-identifier">i</span>])
|
537
|
+
<span class="ruby-keyword">end</span>
|
538
|
+
<span class="ruby-identifier">result</span>
|
539
|
+
<span class="ruby-keyword">end</span></pre>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
</div>
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
</div>
|
548
|
+
|
549
|
+
|
550
|
+
<div id="method-i-to_s" class="method-detail ">
|
551
|
+
|
552
|
+
<div class="method-heading">
|
553
|
+
<span class="method-name">to_s</span><span
|
554
|
+
class="method-args">()</span>
|
555
|
+
|
556
|
+
<span class="method-click-advice">click to toggle source</span>
|
557
|
+
|
558
|
+
</div>
|
559
|
+
|
560
|
+
|
561
|
+
<div class="method-description">
|
562
|
+
|
563
|
+
<p>Método para imprimir la información del plato</p>
|
564
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
565
|
+
<dd>
|
566
|
+
<p>Cadena de texto con la información del plato</p>
|
567
|
+
</dd></dl>
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
<div class="method-source-code" id="to_s-source">
|
573
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/plato.rb, line 49</span>
|
574
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
575
|
+
<span class="ruby-identifier">alimentos</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">name</span> }
|
576
|
+
<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> }
|
577
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-string">""</span>
|
578
|
+
|
579
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"Nombre del plato: #{@name}.\nIngredientes:\n"</span>
|
580
|
+
<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">alimentos</span>.<span class="ruby-identifier">size</span>
|
581
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"- #{alimentos[i]} (#{gramos[i]} gr)\n"</span>
|
582
|
+
<span class="ruby-keyword">end</span>
|
583
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"Kilocalorias totales: #{self.vct} kcal"</span>
|
584
|
+
<span class="ruby-keyword">end</span></pre>
|
585
|
+
</div>
|
586
|
+
|
587
|
+
</div>
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
</div>
|
593
|
+
|
594
|
+
|
595
|
+
</section>
|
596
|
+
|
597
|
+
</section>
|
598
|
+
|
599
|
+
</main>
|
600
|
+
|
601
|
+
|
602
|
+
<footer id="validator-badges" role="contentinfo">
|
603
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
604
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
605
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
606
|
+
</footer>
|
607
|
+
|