nutrientes12345 0.2.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/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +9 -0
- data/Guardfile +10 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimento.html +743 -0
- data/docs/AlimentosCarbohidratos.html +157 -0
- data/docs/AlimentosGrasos.html +157 -0
- data/docs/CarnesDerivados.html +157 -0
- data/docs/Frutas.html +157 -0
- data/docs/HuevosLacteosHelados.html +157 -0
- data/docs/List.html +903 -0
- data/docs/List/Node.html +410 -0
- data/docs/Nutrientes.html +144 -0
- data/docs/PescadosMariscos.html +157 -0
- data/docs/VerdurasHortalizas.html +157 -0
- data/docs/_index.html +218 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +125 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +125 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +219 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/jerarquia.rb +37 -0
- data/lib/list.rb +99 -0
- data/lib/nutrientes.rb +59 -0
- data/lib/nutrientes/version.rb +13 -0
- data/lib/plato.rb +141 -0
- data/nutrientes.gemspec +29 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d1b22b2499060000deffd5834b16878e89eafd53
|
4
|
+
data.tar.gz: 5bf00986eec2b93af88a482aefc2e4725b6132f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fff3908bd2ac1f01fe4d9c1132b3fed2c64f93fe5a359ddc74b2bdd947e2be981227cbb9fc1fc35260e95ed9670f0ca35c8bc0a42efccbbcecf7e3260a1352e5
|
7
|
+
data.tar.gz: e3f17d91eb40cbec08c9d0f13749512b59ab8a6e3d687471f8c6442fe895905c06424e63ceac2b4c2ac26f2d7be281bbe4fc3c2310d3ff74662cb8d9b9fe89e4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
guard 'bundler', cmd: "bundle" do
|
2
|
+
watch('Gemfile')
|
3
|
+
watch(/^.+\.gemspec/)
|
4
|
+
end
|
5
|
+
|
6
|
+
guard 'rspec', cmd: "bundle exec rspec" do
|
7
|
+
watch(%r{^spec/.+_spec\.rb$})
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
9
|
+
watch('spec/spec_helper.rb') { "spec" }
|
10
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Nutrientes
|
2
|
+
|
3
|
+
This gem is used to caluclate the kilocalories of foods given their amount of macronutrients. It was developed by using test-driven development.
|
4
|
+
|
5
|
+
Author: Malte Bossert
|
6
|
+
Práctica 6, Lenguajes y Paradigmas de Programación
|
7
|
+
Universidad de la Laguna, Tenerife
|
8
|
+
|
9
|
+
Brief description [Spanish]:
|
10
|
+
|
11
|
+
Para llevar a cabo todos los procesos que nos permiten estar vivos, el organismo humano necesita un suministro continuo de materiales que debemos ingerir: los nutrientes. Sin embargo, estos nutrientes no se ingieren directamente, sino que forman parte de los alimentos. Las múltiples combinaciones en que la naturaleza ofrece los diferentes nutrientes nos dan una amplia variedad de alimentos que el ser humano puede consumir.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'nutrientes'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install nutrientes
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ULL-ESIT-LPP-1718/tdd-alu0101182773
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nutrientes"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/Alimento.html
ADDED
@@ -0,0 +1,743 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Alimento
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Alimento";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (A)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Alimento</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Alimento
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Alimento</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd>Comparable</dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/nutrientes.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>This class allows to represent a food. It includes the foods Macronutrients
|
111
|
+
and a way to calculate the energetic value. The mixin Comparable is
|
112
|
+
included.</p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
</div><div id="subclasses">
|
121
|
+
<h2>Direct Known Subclasses</h2>
|
122
|
+
<p class="children"><span class='object_link'><a href="AlimentosCarbohidratos.html" title="AlimentosCarbohidratos (class)">AlimentosCarbohidratos</a></span>, <span class='object_link'><a href="AlimentosGrasos.html" title="AlimentosGrasos (class)">AlimentosGrasos</a></span>, <span class='object_link'><a href="CarnesDerivados.html" title="CarnesDerivados (class)">CarnesDerivados</a></span>, <span class='object_link'><a href="Frutas.html" title="Frutas (class)">Frutas</a></span>, <span class='object_link'><a href="HuevosLacteosHelados.html" title="HuevosLacteosHelados (class)">HuevosLacteosHelados</a></span>, <span class='object_link'><a href="PescadosMariscos.html" title="PescadosMariscos (class)">PescadosMariscos</a></span>, <span class='object_link'><a href="VerdurasHortalizas.html" title="VerdurasHortalizas (class)">VerdurasHortalizas</a></span></p>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
129
|
+
<ul class="summary">
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#glucidos-instance_method" title="#glucidos (instance method)">#<strong>glucidos</strong> ⇒ Object </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="note title readonly">readonly</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<span class="summary_desc"><div class='inline'>
|
154
|
+
<p>Returns the value of attribute glucidos.</p>
|
155
|
+
</div></span>
|
156
|
+
|
157
|
+
</li>
|
158
|
+
|
159
|
+
|
160
|
+
<li class="public ">
|
161
|
+
<span class="summary_signature">
|
162
|
+
|
163
|
+
<a href="#grasas-instance_method" title="#grasas (instance method)">#<strong>grasas</strong> ⇒ Object </a>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
</span>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="note title readonly">readonly</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<span class="summary_desc"><div class='inline'>
|
183
|
+
<p>Returns the value of attribute grasas.</p>
|
184
|
+
</div></span>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
|
189
|
+
<li class="public ">
|
190
|
+
<span class="summary_signature">
|
191
|
+
|
192
|
+
<a href="#nombre-instance_method" title="#nombre (instance method)">#<strong>nombre</strong> ⇒ Object </a>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
<span class="note title readonly">readonly</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<span class="summary_desc"><div class='inline'>
|
212
|
+
<p>Returns the value of attribute nombre.</p>
|
213
|
+
</div></span>
|
214
|
+
|
215
|
+
</li>
|
216
|
+
|
217
|
+
|
218
|
+
<li class="public ">
|
219
|
+
<span class="summary_signature">
|
220
|
+
|
221
|
+
<a href="#proteinas-instance_method" title="#proteinas (instance method)">#<strong>proteinas</strong> ⇒ Object </a>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
</span>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
<span class="note title readonly">readonly</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'>
|
241
|
+
<p>Returns the value of attribute proteinas.</p>
|
242
|
+
</div></span>
|
243
|
+
|
244
|
+
</li>
|
245
|
+
|
246
|
+
|
247
|
+
</ul>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<h2>
|
254
|
+
Instance Method Summary
|
255
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
256
|
+
</h2>
|
257
|
+
|
258
|
+
<ul class="summary">
|
259
|
+
|
260
|
+
<li class="public ">
|
261
|
+
<span class="summary_signature">
|
262
|
+
|
263
|
+
<a href="#<=>-instance_method" title="#<=> (instance method)">#<strong><=></strong>(anOther) ⇒ Object </a>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
</span>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<span class="summary_desc"><div class='inline'>
|
278
|
+
<p>This method is defined because we included the mixin Comparable We take the
|
279
|
+
energetic Value as our means to compare two foods.</p>
|
280
|
+
</div></span>
|
281
|
+
|
282
|
+
</li>
|
283
|
+
|
284
|
+
|
285
|
+
<li class="public ">
|
286
|
+
<span class="summary_signature">
|
287
|
+
|
288
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(nombre, proteinas, glucidos, grasas) ⇒ Alimento </a>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
</span>
|
293
|
+
|
294
|
+
|
295
|
+
<span class="note title constructor">constructor</span>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
<span class="summary_desc"><div class='inline'>
|
305
|
+
<p>Name and percentage of proteins, carbohydrates and fats are assigned.</p>
|
306
|
+
</div></span>
|
307
|
+
|
308
|
+
</li>
|
309
|
+
|
310
|
+
|
311
|
+
<li class="public ">
|
312
|
+
<span class="summary_signature">
|
313
|
+
|
314
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ Object </a>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
</span>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<span class="summary_desc"><div class='inline'>
|
329
|
+
<p>returns this food in a nicely formatted way.</p>
|
330
|
+
</div></span>
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
|
335
|
+
<li class="public ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#valorEnergetico-instance_method" title="#valorEnergetico (instance method)">#<strong>valorEnergetico</strong>(gramos = 100) ⇒ Object </a>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<span class="summary_desc"><div class='inline'>
|
353
|
+
<p>calculates the energetic value of a food, generally of 100 grams of this
|
354
|
+
food.</p>
|
355
|
+
</div></span>
|
356
|
+
|
357
|
+
</li>
|
358
|
+
|
359
|
+
|
360
|
+
</ul>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<div id="constructor_details" class="method_details_list">
|
365
|
+
<h2>Constructor Details</h2>
|
366
|
+
|
367
|
+
<div class="method_details first">
|
368
|
+
<h3 class="signature first" id="initialize-instance_method">
|
369
|
+
|
370
|
+
#<strong>initialize</strong>(nombre, proteinas, glucidos, grasas) ⇒ <tt><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></tt>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</h3><div class="docstring">
|
377
|
+
<div class="discussion">
|
378
|
+
|
379
|
+
<p>Name and percentage of proteins, carbohydrates and fats are assigned</p>
|
380
|
+
|
381
|
+
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
<div class="tags">
|
385
|
+
|
386
|
+
|
387
|
+
</div><table class="source_code">
|
388
|
+
<tr>
|
389
|
+
<td>
|
390
|
+
<pre class="lines">
|
391
|
+
|
392
|
+
|
393
|
+
12
|
394
|
+
13
|
395
|
+
14
|
396
|
+
15
|
397
|
+
16
|
398
|
+
17</pre>
|
399
|
+
</td>
|
400
|
+
<td>
|
401
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 12</span>
|
402
|
+
|
403
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='lparen'>(</span><span class='id identifier rubyid_nombre'>nombre</span><span class='comma'>,</span> <span class='id identifier rubyid_proteinas'>proteinas</span><span class='comma'>,</span> <span class='id identifier rubyid_glucidos'>glucidos</span><span class='comma'>,</span> <span class='id identifier rubyid_grasas'>grasas</span><span class='rparen'>)</span>
|
404
|
+
<span class='ivar'>@nombre</span> <span class='op'>=</span> <span class='id identifier rubyid_nombre'>nombre</span>
|
405
|
+
<span class='ivar'>@proteinas</span> <span class='op'>=</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
|
406
|
+
<span class='ivar'>@glucidos</span> <span class='op'>=</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
|
407
|
+
<span class='ivar'>@grasas</span> <span class='op'>=</span> <span class='id identifier rubyid_grasas'>grasas</span>
|
408
|
+
<span class='kw'>end</span></pre>
|
409
|
+
</td>
|
410
|
+
</tr>
|
411
|
+
</table>
|
412
|
+
</div>
|
413
|
+
|
414
|
+
</div>
|
415
|
+
|
416
|
+
<div id="instance_attr_details" class="attr_details">
|
417
|
+
<h2>Instance Attribute Details</h2>
|
418
|
+
|
419
|
+
|
420
|
+
<span id=""></span>
|
421
|
+
<div class="method_details first">
|
422
|
+
<h3 class="signature first" id="glucidos-instance_method">
|
423
|
+
|
424
|
+
#<strong>glucidos</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
</h3><div class="docstring">
|
431
|
+
<div class="discussion">
|
432
|
+
|
433
|
+
<p>Returns the value of attribute glucidos</p>
|
434
|
+
|
435
|
+
|
436
|
+
</div>
|
437
|
+
</div>
|
438
|
+
<div class="tags">
|
439
|
+
|
440
|
+
|
441
|
+
</div><table class="source_code">
|
442
|
+
<tr>
|
443
|
+
<td>
|
444
|
+
<pre class="lines">
|
445
|
+
|
446
|
+
|
447
|
+
9
|
448
|
+
10
|
449
|
+
11</pre>
|
450
|
+
</td>
|
451
|
+
<td>
|
452
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 9</span>
|
453
|
+
|
454
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
|
455
|
+
<span class='ivar'>@glucidos</span>
|
456
|
+
<span class='kw'>end</span></pre>
|
457
|
+
</td>
|
458
|
+
</tr>
|
459
|
+
</table>
|
460
|
+
</div>
|
461
|
+
|
462
|
+
|
463
|
+
<span id=""></span>
|
464
|
+
<div class="method_details ">
|
465
|
+
<h3 class="signature " id="grasas-instance_method">
|
466
|
+
|
467
|
+
#<strong>grasas</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
</h3><div class="docstring">
|
474
|
+
<div class="discussion">
|
475
|
+
|
476
|
+
<p>Returns the value of attribute grasas</p>
|
477
|
+
|
478
|
+
|
479
|
+
</div>
|
480
|
+
</div>
|
481
|
+
<div class="tags">
|
482
|
+
|
483
|
+
|
484
|
+
</div><table class="source_code">
|
485
|
+
<tr>
|
486
|
+
<td>
|
487
|
+
<pre class="lines">
|
488
|
+
|
489
|
+
|
490
|
+
9
|
491
|
+
10
|
492
|
+
11</pre>
|
493
|
+
</td>
|
494
|
+
<td>
|
495
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 9</span>
|
496
|
+
|
497
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_grasas'>grasas</span>
|
498
|
+
<span class='ivar'>@grasas</span>
|
499
|
+
<span class='kw'>end</span></pre>
|
500
|
+
</td>
|
501
|
+
</tr>
|
502
|
+
</table>
|
503
|
+
</div>
|
504
|
+
|
505
|
+
|
506
|
+
<span id=""></span>
|
507
|
+
<div class="method_details ">
|
508
|
+
<h3 class="signature " id="nombre-instance_method">
|
509
|
+
|
510
|
+
#<strong>nombre</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
</h3><div class="docstring">
|
517
|
+
<div class="discussion">
|
518
|
+
|
519
|
+
<p>Returns the value of attribute nombre</p>
|
520
|
+
|
521
|
+
|
522
|
+
</div>
|
523
|
+
</div>
|
524
|
+
<div class="tags">
|
525
|
+
|
526
|
+
|
527
|
+
</div><table class="source_code">
|
528
|
+
<tr>
|
529
|
+
<td>
|
530
|
+
<pre class="lines">
|
531
|
+
|
532
|
+
|
533
|
+
9
|
534
|
+
10
|
535
|
+
11</pre>
|
536
|
+
</td>
|
537
|
+
<td>
|
538
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 9</span>
|
539
|
+
|
540
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_nombre'>nombre</span>
|
541
|
+
<span class='ivar'>@nombre</span>
|
542
|
+
<span class='kw'>end</span></pre>
|
543
|
+
</td>
|
544
|
+
</tr>
|
545
|
+
</table>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
|
549
|
+
<span id=""></span>
|
550
|
+
<div class="method_details ">
|
551
|
+
<h3 class="signature " id="proteinas-instance_method">
|
552
|
+
|
553
|
+
#<strong>proteinas</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
</h3><div class="docstring">
|
560
|
+
<div class="discussion">
|
561
|
+
|
562
|
+
<p>Returns the value of attribute proteinas</p>
|
563
|
+
|
564
|
+
|
565
|
+
</div>
|
566
|
+
</div>
|
567
|
+
<div class="tags">
|
568
|
+
|
569
|
+
|
570
|
+
</div><table class="source_code">
|
571
|
+
<tr>
|
572
|
+
<td>
|
573
|
+
<pre class="lines">
|
574
|
+
|
575
|
+
|
576
|
+
9
|
577
|
+
10
|
578
|
+
11</pre>
|
579
|
+
</td>
|
580
|
+
<td>
|
581
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 9</span>
|
582
|
+
|
583
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
|
584
|
+
<span class='ivar'>@proteinas</span>
|
585
|
+
<span class='kw'>end</span></pre>
|
586
|
+
</td>
|
587
|
+
</tr>
|
588
|
+
</table>
|
589
|
+
</div>
|
590
|
+
|
591
|
+
</div>
|
592
|
+
|
593
|
+
|
594
|
+
<div id="instance_method_details" class="method_details_list">
|
595
|
+
<h2>Instance Method Details</h2>
|
596
|
+
|
597
|
+
|
598
|
+
<div class="method_details first">
|
599
|
+
<h3 class="signature first" id="<=>-instance_method">
|
600
|
+
|
601
|
+
#<strong><=></strong>(anOther) ⇒ <tt>Object</tt>
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
</h3><div class="docstring">
|
608
|
+
<div class="discussion">
|
609
|
+
|
610
|
+
<p>This method is defined because we included the mixin Comparable We take the
|
611
|
+
energetic Value as our means to compare two foods</p>
|
612
|
+
|
613
|
+
|
614
|
+
</div>
|
615
|
+
</div>
|
616
|
+
<div class="tags">
|
617
|
+
|
618
|
+
|
619
|
+
</div><table class="source_code">
|
620
|
+
<tr>
|
621
|
+
<td>
|
622
|
+
<pre class="lines">
|
623
|
+
|
624
|
+
|
625
|
+
32
|
626
|
+
33
|
627
|
+
34
|
628
|
+
35
|
629
|
+
36
|
630
|
+
37
|
631
|
+
38</pre>
|
632
|
+
</td>
|
633
|
+
<td>
|
634
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 32</span>
|
635
|
+
|
636
|
+
<span class='kw'>def</span> <span class='op'><=></span> <span class='lparen'>(</span><span class='id identifier rubyid_anOther'>anOther</span><span class='rparen'>)</span>
|
637
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_anOther'>anOther</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></span><span class='rparen'>)</span> <span class='op'>==</span> <span class='kw'>false</span>
|
638
|
+
<span class='kw'>nil</span>
|
639
|
+
<span class='kw'>else</span>
|
640
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_valorEnergetico'>valorEnergetico</span> <span class='op'><=></span> <span class='id identifier rubyid_anOther'>anOther</span><span class='period'>.</span><span class='id identifier rubyid_valorEnergetico'>valorEnergetico</span>
|
641
|
+
<span class='kw'>end</span>
|
642
|
+
<span class='kw'>end</span></pre>
|
643
|
+
</td>
|
644
|
+
</tr>
|
645
|
+
</table>
|
646
|
+
</div>
|
647
|
+
|
648
|
+
<div class="method_details ">
|
649
|
+
<h3 class="signature " id="to_s-instance_method">
|
650
|
+
|
651
|
+
#<strong>to_s</strong> ⇒ <tt>Object</tt>
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
</h3><div class="docstring">
|
658
|
+
<div class="discussion">
|
659
|
+
|
660
|
+
<p>returns this food in a nicely formatted way</p>
|
661
|
+
|
662
|
+
|
663
|
+
</div>
|
664
|
+
</div>
|
665
|
+
<div class="tags">
|
666
|
+
|
667
|
+
|
668
|
+
</div><table class="source_code">
|
669
|
+
<tr>
|
670
|
+
<td>
|
671
|
+
<pre class="lines">
|
672
|
+
|
673
|
+
|
674
|
+
20
|
675
|
+
21
|
676
|
+
22</pre>
|
677
|
+
</td>
|
678
|
+
<td>
|
679
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 20</span>
|
680
|
+
|
681
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
682
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@nombre</span><span class='embexpr_end'>}</span><span class='tstring_content'>:\nProteínas:\t </span><span class='embexpr_beg'>#{</span><span class='ivar'>@proteinas</span><span class='embexpr_end'>}</span><span class='tstring_content'> gramos\nGlúcidos:\t </span><span class='embexpr_beg'>#{</span><span class='ivar'>@glucidos</span><span class='embexpr_end'>}</span><span class='tstring_content'> gramos\nLípidos:\t </span><span class='embexpr_beg'>#{</span><span class='ivar'>@grasas</span><span class='embexpr_end'>}</span><span class='tstring_content'> gramos\n\t\t por 100 gramos</span><span class='tstring_end'>"</span></span>
|
683
|
+
<span class='kw'>end</span></pre>
|
684
|
+
</td>
|
685
|
+
</tr>
|
686
|
+
</table>
|
687
|
+
</div>
|
688
|
+
|
689
|
+
<div class="method_details ">
|
690
|
+
<h3 class="signature " id="valorEnergetico-instance_method">
|
691
|
+
|
692
|
+
#<strong>valorEnergetico</strong>(gramos = 100) ⇒ <tt>Object</tt>
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
</h3><div class="docstring">
|
699
|
+
<div class="discussion">
|
700
|
+
|
701
|
+
<p>calculates the energetic value of a food, generally of 100 grams of this
|
702
|
+
food. This can be changed by the user, depending on her needs</p>
|
703
|
+
|
704
|
+
|
705
|
+
</div>
|
706
|
+
</div>
|
707
|
+
<div class="tags">
|
708
|
+
|
709
|
+
|
710
|
+
</div><table class="source_code">
|
711
|
+
<tr>
|
712
|
+
<td>
|
713
|
+
<pre class="lines">
|
714
|
+
|
715
|
+
|
716
|
+
26
|
717
|
+
27
|
718
|
+
28</pre>
|
719
|
+
</td>
|
720
|
+
<td>
|
721
|
+
<pre class="code"><span class="info file"># File 'lib/nutrientes.rb', line 26</span>
|
722
|
+
|
723
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_valorEnergetico'>valorEnergetico</span> <span class='lparen'>(</span><span class='id identifier rubyid_gramos'>gramos</span> <span class='op'>=</span> <span class='int'>100</span><span class='rparen'>)</span>
|
724
|
+
<span class='lparen'>(</span><span class='lparen'>(</span><span class='ivar'>@proteinas</span> <span class='op'>*</span> <span class='int'>4</span> <span class='op'>+</span> <span class='ivar'>@glucidos</span> <span class='op'>*</span> <span class='int'>4</span> <span class='op'>+</span> <span class='ivar'>@grasas</span> <span class='op'>*</span> <span class='int'>9</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='int'>100</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='id identifier rubyid_gramos'>gramos</span>
|
725
|
+
<span class='kw'>end</span></pre>
|
726
|
+
</td>
|
727
|
+
</tr>
|
728
|
+
</table>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
</div>
|
732
|
+
|
733
|
+
</div>
|
734
|
+
|
735
|
+
<div id="footer">
|
736
|
+
Generated on Wed Nov 15 00:31:53 2017 by
|
737
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
738
|
+
0.9.9 (ruby-2.3.0).
|
739
|
+
</div>
|
740
|
+
|
741
|
+
</div>
|
742
|
+
</body>
|
743
|
+
</html>
|