practica6germanAT 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 46087f3fa2d0e8e9c35cfa4062c4a91baccf6abe7abfa75fc3065eded08757bd
4
+ data.tar.gz: e915039cbe615343394616c9eb67206ea74956a65af962ce60fe41165f801e2f
5
+ SHA512:
6
+ metadata.gz: 070cb5535b4cf32999f06991d050201505c72b7dd26c9398d76469b98fdca12b178acf0e09178a19791c9e14c7bf767aa99c272d9ebcdbb246bbf04ba086c666
7
+ data.tar.gz: 2d13e54cabe5ecb1ef2423bbf3ac66e81b5838e11a1b1c09cc5fbfe639993030972e8a9d33c9f8b562a7358d8de9c8845ef95a0b7424aa004f9563560642461f
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-pro
2
+ repo_token: 7YirllppCJbHPhjo1FZiROGK8iUfmuVMG
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+
9
+ # rspec failure tracking
10
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ script:
8
+ - bundle exec rspec spec
9
+ before_install: gem install bundler -v 2.0.2
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in practica6.gemspec
4
+ gemspec
5
+ gem 'coveralls', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ practica6 (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ coveralls (0.8.23)
11
+ json (>= 1.8, < 3)
12
+ simplecov (~> 0.16.1)
13
+ term-ansicolor (~> 1.3)
14
+ thor (>= 0.19.4, < 2.0)
15
+ tins (~> 1.6)
16
+ diff-lcs (1.3)
17
+ docile (1.3.2)
18
+ ffi (1.11.2)
19
+ formatador (0.2.5)
20
+ guard (2.16.1)
21
+ formatador (>= 0.2.4)
22
+ listen (>= 2.7, < 4.0)
23
+ lumberjack (>= 1.0.12, < 2.0)
24
+ nenv (~> 0.1)
25
+ notiffany (~> 0.0)
26
+ pry (>= 0.9.12)
27
+ shellany (~> 0.0)
28
+ thor (>= 0.18.1)
29
+ guard-bundler (2.2.1)
30
+ bundler (>= 1.3.0, < 3)
31
+ guard (~> 2.2)
32
+ guard-compat (~> 1.1)
33
+ guard-compat (1.2.1)
34
+ guard-rspec (4.7.3)
35
+ guard (~> 2.1)
36
+ guard-compat (~> 1.1)
37
+ rspec (>= 2.99.0, < 4.0)
38
+ json (2.3.0)
39
+ listen (3.2.0)
40
+ rb-fsevent (~> 0.10, >= 0.10.3)
41
+ rb-inotify (~> 0.9, >= 0.9.10)
42
+ lumberjack (1.0.13)
43
+ method_source (0.9.2)
44
+ nenv (0.3.0)
45
+ notiffany (0.1.3)
46
+ nenv (~> 0.1)
47
+ shellany (~> 0.0)
48
+ pry (0.12.2)
49
+ coderay (~> 1.1.0)
50
+ method_source (~> 0.9.0)
51
+ rake (10.5.0)
52
+ rb-fsevent (0.10.3)
53
+ rb-inotify (0.10.0)
54
+ ffi (~> 1.0)
55
+ rspec (3.9.0)
56
+ rspec-core (~> 3.9.0)
57
+ rspec-expectations (~> 3.9.0)
58
+ rspec-mocks (~> 3.9.0)
59
+ rspec-core (3.9.0)
60
+ rspec-support (~> 3.9.0)
61
+ rspec-expectations (3.9.0)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.9.0)
64
+ rspec-mocks (3.9.0)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.9.0)
67
+ rspec-support (3.9.0)
68
+ shellany (0.0.1)
69
+ simplecov (0.16.1)
70
+ docile (~> 1.1)
71
+ json (>= 1.8, < 3)
72
+ simplecov-html (~> 0.10.0)
73
+ simplecov-html (0.10.2)
74
+ sync (0.5.0)
75
+ term-ansicolor (1.7.1)
76
+ tins (~> 1.0)
77
+ thor (0.20.3)
78
+ tins (1.23.0)
79
+ sync
80
+
81
+ PLATFORMS
82
+ ruby
83
+
84
+ DEPENDENCIES
85
+ bundler (~> 2.0)
86
+ coveralls
87
+ guard
88
+ guard-bundler
89
+ guard-rspec
90
+ practica6!
91
+ rake (~> 10.0)
92
+ rspec (~> 3.0)
93
+
94
+ BUNDLED WITH
95
+ 2.0.2
data/Guardfile ADDED
@@ -0,0 +1,85 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ #directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard :bundler do
19
+ require 'guard/bundler'
20
+ require 'guard/bundler/verify'
21
+ helper = Guard::Bundler::Verify.new
22
+
23
+ files = ['Gemfile']
24
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
25
+
26
+ # Assume files are symlinked from somewhere
27
+ files.each { |file| watch(helper.real_path(file)) }
28
+ end
29
+
30
+ # Note: The cmd option is now required due to the increasing number of ways
31
+ # rspec may be run, below are examples of the most common uses.
32
+ # * bundler: 'bundle exec rspec'
33
+ # * bundler binstubs: 'bin/rspec'
34
+ # * spring: 'bin/rspec' (This will use spring if running and you have
35
+ # installed the spring binstubs per the docs)
36
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
37
+ # * 'just' rspec: 'rspec'
38
+
39
+ guard :rspec, cmd: "bundle exec rspec" do
40
+ require "guard/rspec/dsl"
41
+ dsl = Guard::RSpec::Dsl.new(self)
42
+
43
+ # Feel free to open issues for suggestions and improvements
44
+ watch(%r{^lib/practica6/(.+)\.rb$}) {dsl.rspec.spec_dir}
45
+
46
+
47
+ # RSpec files
48
+ rspec = dsl.rspec
49
+ watch(rspec.spec_helper) { rspec.spec_dir }
50
+ watch(rspec.spec_support) { rspec.spec_dir }
51
+ watch(rspec.spec_files)
52
+
53
+ # Ruby files
54
+ ruby = dsl.ruby
55
+ dsl.watch_spec_files_for(ruby.lib_files)
56
+
57
+
58
+ # Rails files
59
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
60
+ dsl.watch_spec_files_for(rails.app_files)
61
+ dsl.watch_spec_files_for(rails.views)
62
+
63
+ watch(rails.controllers) do |m|
64
+ [
65
+ rspec.spec.call("routing/#{m[1]}_routing"),
66
+ rspec.spec.call("controllers/#{m[1]}_controller"),
67
+ rspec.spec.call("acceptance/#{m[1]}")
68
+ ]
69
+ end
70
+
71
+ # Rails config changes
72
+ watch(rails.spec_helper) { rspec.spec_dir }
73
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
74
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
75
+
76
+ # Capybara features specs
77
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
78
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
79
+
80
+ # Turnip features and steps
81
+ watch(%r{^spec/acceptance/(.+)\.feature$})
82
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
83
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
84
+ end
85
+ end
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Práctica 6
2
+
3
+ ## Autor
4
+ Germán Alfonso Teixidó alu0100961768
5
+
6
+ ## Objetivos
7
+ Mostrar entendimiento y dominio del desarrollo de código aplicando la metodología TDD y la programación orientada a objetos.
8
+
9
+ ## Procedimiento
10
+ ![](http://www.agiledata.org/images/tddSteps.jpg)
11
+
12
+ Se generan tests para una pequeña parte del código que aún no existe. Se comprueba que dichos test fallen.
13
+
14
+ Una vez comprobado, se procede a realizar el código para satisfacer las pruebas asignadas.
15
+
16
+ Repetir el proceso hasta terminar con la práctica asignada.
17
+
18
+ ## Herramientas utilizadas
19
+ bundler, RSpec.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "practica6"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/doc/Comida.html ADDED
@@ -0,0 +1,1030 @@
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: Comida
8
+
9
+ &mdash; Documentation by YARD 0.9.20
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 = "Comida";
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 (C)</a> &raquo;
40
+
41
+
42
+ <span class="title">Comida</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: Comida
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">Comida</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/practica6/comida.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+
108
+
109
+
110
+
111
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
112
+ <ul class="summary">
113
+
114
+ <li class="public ">
115
+ <span class="summary_signature">
116
+
117
+ <a href="#carbohidratos-instance_method" title="#carbohidratos (instance method)">#<strong>carbohidratos</strong> &#x21d2; Object </a>
118
+
119
+
120
+
121
+ </span>
122
+
123
+
124
+
125
+
126
+ <span class="note title readonly">readonly</span>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <span class="summary_desc"><div class='inline'>
137
+ <p>Los atributos son de lectura.</p>
138
+ </div></span>
139
+
140
+ </li>
141
+
142
+
143
+ <li class="public ">
144
+ <span class="summary_signature">
145
+
146
+ <a href="#costeTerreno-instance_method" title="#costeTerreno (instance method)">#<strong>costeTerreno</strong> &#x21d2; Object </a>
147
+
148
+
149
+
150
+ </span>
151
+
152
+
153
+
154
+
155
+ <span class="note title readonly">readonly</span>
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <span class="summary_desc"><div class='inline'>
166
+ <p>Los atributos son de lectura.</p>
167
+ </div></span>
168
+
169
+ </li>
170
+
171
+
172
+ <li class="public ">
173
+ <span class="summary_signature">
174
+
175
+ <a href="#GEI-instance_method" title="#GEI (instance method)">#<strong>GEI</strong> &#x21d2; Object </a>
176
+
177
+
178
+
179
+ </span>
180
+
181
+
182
+
183
+
184
+ <span class="note title readonly">readonly</span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'>
195
+ <p>Los atributos son de lectura.</p>
196
+ </div></span>
197
+
198
+ </li>
199
+
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#lipidos-instance_method" title="#lipidos (instance method)">#<strong>lipidos</strong> &#x21d2; Object </a>
205
+
206
+
207
+
208
+ </span>
209
+
210
+
211
+
212
+
213
+ <span class="note title readonly">readonly</span>
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <span class="summary_desc"><div class='inline'>
224
+ <p>Los atributos son de lectura.</p>
225
+ </div></span>
226
+
227
+ </li>
228
+
229
+
230
+ <li class="public ">
231
+ <span class="summary_signature">
232
+
233
+ <a href="#nombre-instance_method" title="#nombre (instance method)">#<strong>nombre</strong> &#x21d2; Object </a>
234
+
235
+
236
+
237
+ </span>
238
+
239
+
240
+
241
+
242
+ <span class="note title readonly">readonly</span>
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ <span class="summary_desc"><div class='inline'>
253
+ <p>Los atributos son de lectura.</p>
254
+ </div></span>
255
+
256
+ </li>
257
+
258
+
259
+ <li class="public ">
260
+ <span class="summary_signature">
261
+
262
+ <a href="#proteinas-instance_method" title="#proteinas (instance method)">#<strong>proteinas</strong> &#x21d2; Object </a>
263
+
264
+
265
+
266
+ </span>
267
+
268
+
269
+
270
+
271
+ <span class="note title readonly">readonly</span>
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+ <span class="summary_desc"><div class='inline'>
282
+ <p>Los atributos son de lectura.</p>
283
+ </div></span>
284
+
285
+ </li>
286
+
287
+
288
+ </ul>
289
+
290
+
291
+
292
+
293
+
294
+ <h2>
295
+ Instance Method Summary
296
+ <small><a href="#" class="summary_toggle">collapse</a></small>
297
+ </h2>
298
+
299
+ <ul class="summary">
300
+
301
+ <li class="public ">
302
+ <span class="summary_signature">
303
+
304
+ <a href="#<=>-instance_method" title="#&lt;=&gt; (instance method)">#<strong>&lt;=&gt;</strong>(another) &#x21d2; Object </a>
305
+
306
+
307
+
308
+ </span>
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+ <span class="summary_desc"><div class='inline'>
319
+ <p>Sobreescritura de la funcion &lt;=&gt; de la clase Comparable para comparar
320
+ dos elementos.</p>
321
+ </div></span>
322
+
323
+ </li>
324
+
325
+
326
+ <li class="public ">
327
+ <span class="summary_signature">
328
+
329
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(nombre, proteinas, carbohidratos, lipidos, gei, costeTerreno) &#x21d2; Comida </a>
330
+
331
+
332
+
333
+ </span>
334
+
335
+
336
+ <span class="note title constructor">constructor</span>
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+ <span class="summary_desc"><div class='inline'>
346
+ <p>Constructor.</p>
347
+ </div></span>
348
+
349
+ </li>
350
+
351
+
352
+ <li class="public ">
353
+ <span class="summary_signature">
354
+
355
+ <a href="#kilocalorias-instance_method" title="#kilocalorias (instance method)">#<strong>kilocalorias</strong> &#x21d2; Double </a>
356
+
357
+
358
+
359
+ </span>
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+ <span class="summary_desc"><div class='inline'>
370
+ <p>Devuelve un double con las kilocalorias que proporciona el alimento.</p>
371
+ </div></span>
372
+
373
+ </li>
374
+
375
+
376
+ <li class="public ">
377
+ <span class="summary_signature">
378
+
379
+ <a href="#resumen-instance_method" title="#resumen (instance method)">#<strong>resumen</strong> &#x21d2; String </a>
380
+
381
+
382
+
383
+ </span>
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+ <span class="summary_desc"><div class='inline'>
394
+ <p>Devuelve un string con un resumen del alimento.</p>
395
+ </div></span>
396
+
397
+ </li>
398
+
399
+
400
+ </ul>
401
+
402
+
403
+
404
+ <div id="constructor_details" class="method_details_list">
405
+ <h2>Constructor Details</h2>
406
+
407
+ <div class="method_details first">
408
+ <h3 class="signature first" id="initialize-instance_method">
409
+
410
+ #<strong>initialize</strong>(nombre, proteinas, carbohidratos, lipidos, gei, costeTerreno) &#x21d2; <tt><span class='object_link'><a href="" title="Comida (class)">Comida</a></span></tt>
411
+
412
+
413
+
414
+
415
+
416
+ </h3><div class="docstring">
417
+ <div class="discussion">
418
+
419
+ <p>Constructor</p>
420
+
421
+
422
+ </div>
423
+ </div>
424
+ <div class="tags">
425
+ <p class="tag_title">Parameters:</p>
426
+ <ul class="param">
427
+
428
+ <li>
429
+
430
+ <span class='name'>nombre</span>
431
+
432
+
433
+ <span class='type'>(<tt>String</tt>)</span>
434
+
435
+
436
+
437
+ &mdash;
438
+ <div class='inline'>
439
+ <p>Nombre del alimento.</p>
440
+ </div>
441
+
442
+ </li>
443
+
444
+ <li>
445
+
446
+ <span class='name'>proteinas</span>
447
+
448
+
449
+ <span class='type'>(<tt>Integer</tt>)</span>
450
+
451
+
452
+
453
+ &mdash;
454
+ <div class='inline'>
455
+ <p>Cantidad en gramos de proteinas.</p>
456
+ </div>
457
+
458
+ </li>
459
+
460
+ <li>
461
+
462
+ <span class='name'>carbohidratos</span>
463
+
464
+
465
+ <span class='type'>(<tt>Integer</tt>)</span>
466
+
467
+
468
+
469
+ &mdash;
470
+ <div class='inline'>
471
+ <p>Cantidad en gramos de carbohidratos.</p>
472
+ </div>
473
+
474
+ </li>
475
+
476
+ <li>
477
+
478
+ <span class='name'>lipidos</span>
479
+
480
+
481
+ <span class='type'>(<tt>Integer</tt>)</span>
482
+
483
+
484
+
485
+ &mdash;
486
+ <div class='inline'>
487
+ <p>Cantidad en gramos de lipidos.</p>
488
+ </div>
489
+
490
+ </li>
491
+
492
+ <li>
493
+
494
+ <span class='name'>gei</span>
495
+
496
+
497
+ <span class='type'>(<tt>Integer</tt>)</span>
498
+
499
+
500
+
501
+ &mdash;
502
+ <div class='inline'>
503
+ <p>Gases de efecto invernadero emitidos en la producción de 1000g de este
504
+ alimento</p>
505
+ </div>
506
+
507
+ </li>
508
+
509
+ <li>
510
+
511
+ <span class='name'>costeTerreno</span>
512
+
513
+
514
+ <span class='type'>(<tt>Integer</tt>)</span>
515
+
516
+
517
+
518
+ &mdash;
519
+ <div class='inline'>
520
+ <p>m2 utilizados en la producción de 1000g de este alimento</p>
521
+ </div>
522
+
523
+ </li>
524
+
525
+ </ul>
526
+
527
+
528
+ </div><table class="source_code">
529
+ <tr>
530
+ <td>
531
+ <pre class="lines">
532
+
533
+
534
+ 18
535
+ 19
536
+ 20</pre>
537
+ </td>
538
+ <td>
539
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 18</span>
540
+
541
+ <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_carbohidratos'>carbohidratos</span><span class='comma'>,</span> <span class='id identifier rubyid_lipidos'>lipidos</span><span class='comma'>,</span> <span class='id identifier rubyid_gei'>gei</span><span class='comma'>,</span> <span class='id identifier rubyid_costeTerreno'>costeTerreno</span><span class='rparen'>)</span>
542
+ <span class='ivar'>@nombre</span><span class='comma'>,</span> <span class='ivar'>@proteinas</span><span class='comma'>,</span> <span class='ivar'>@carbohidratos</span><span class='comma'>,</span> <span class='ivar'>@lipidos</span><span class='comma'>,</span> <span class='ivar'>@GEI</span><span class='comma'>,</span> <span class='ivar'>@costeTerreno</span><span class='op'>=</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_carbohidratos'>carbohidratos</span><span class='comma'>,</span> <span class='id identifier rubyid_lipidos'>lipidos</span><span class='comma'>,</span> <span class='id identifier rubyid_gei'>gei</span><span class='comma'>,</span> <span class='id identifier rubyid_costeTerreno'>costeTerreno</span>
543
+ <span class='kw'>end</span></pre>
544
+ </td>
545
+ </tr>
546
+ </table>
547
+ </div>
548
+
549
+ </div>
550
+
551
+ <div id="instance_attr_details" class="attr_details">
552
+ <h2>Instance Attribute Details</h2>
553
+
554
+
555
+ <span id=""></span>
556
+ <div class="method_details first">
557
+ <h3 class="signature first" id="carbohidratos-instance_method">
558
+
559
+ #<strong>carbohidratos</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
560
+
561
+
562
+
563
+
564
+
565
+ </h3><div class="docstring">
566
+ <div class="discussion">
567
+
568
+ <p>Los atributos son de lectura</p>
569
+
570
+
571
+ </div>
572
+ </div>
573
+ <div class="tags">
574
+
575
+
576
+ </div><table class="source_code">
577
+ <tr>
578
+ <td>
579
+ <pre class="lines">
580
+
581
+
582
+ 6
583
+ 7
584
+ 8</pre>
585
+ </td>
586
+ <td>
587
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 6</span>
588
+
589
+ <span class='kw'>def</span> <span class='id identifier rubyid_carbohidratos'>carbohidratos</span>
590
+ <span class='ivar'>@carbohidratos</span>
591
+ <span class='kw'>end</span></pre>
592
+ </td>
593
+ </tr>
594
+ </table>
595
+ </div>
596
+
597
+
598
+ <span id=""></span>
599
+ <div class="method_details ">
600
+ <h3 class="signature " id="costeTerreno-instance_method">
601
+
602
+ #<strong>costeTerreno</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
603
+
604
+
605
+
606
+
607
+
608
+ </h3><div class="docstring">
609
+ <div class="discussion">
610
+
611
+ <p>Los atributos son de lectura</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
+ 6
626
+ 7
627
+ 8</pre>
628
+ </td>
629
+ <td>
630
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 6</span>
631
+
632
+ <span class='kw'>def</span> <span class='id identifier rubyid_costeTerreno'>costeTerreno</span>
633
+ <span class='ivar'>@costeTerreno</span>
634
+ <span class='kw'>end</span></pre>
635
+ </td>
636
+ </tr>
637
+ </table>
638
+ </div>
639
+
640
+
641
+ <span id=""></span>
642
+ <div class="method_details ">
643
+ <h3 class="signature " id="GEI-instance_method">
644
+
645
+ #<strong>GEI</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
646
+
647
+
648
+
649
+
650
+
651
+ </h3><div class="docstring">
652
+ <div class="discussion">
653
+
654
+ <p>Los atributos son de lectura</p>
655
+
656
+
657
+ </div>
658
+ </div>
659
+ <div class="tags">
660
+
661
+
662
+ </div><table class="source_code">
663
+ <tr>
664
+ <td>
665
+ <pre class="lines">
666
+
667
+
668
+ 6
669
+ 7
670
+ 8</pre>
671
+ </td>
672
+ <td>
673
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 6</span>
674
+
675
+ <span class='kw'>def</span> <span class='const'>GEI</span>
676
+ <span class='ivar'>@GEI</span>
677
+ <span class='kw'>end</span></pre>
678
+ </td>
679
+ </tr>
680
+ </table>
681
+ </div>
682
+
683
+
684
+ <span id=""></span>
685
+ <div class="method_details ">
686
+ <h3 class="signature " id="lipidos-instance_method">
687
+
688
+ #<strong>lipidos</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
689
+
690
+
691
+
692
+
693
+
694
+ </h3><div class="docstring">
695
+ <div class="discussion">
696
+
697
+ <p>Los atributos son de lectura</p>
698
+
699
+
700
+ </div>
701
+ </div>
702
+ <div class="tags">
703
+
704
+
705
+ </div><table class="source_code">
706
+ <tr>
707
+ <td>
708
+ <pre class="lines">
709
+
710
+
711
+ 6
712
+ 7
713
+ 8</pre>
714
+ </td>
715
+ <td>
716
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 6</span>
717
+
718
+ <span class='kw'>def</span> <span class='id identifier rubyid_lipidos'>lipidos</span>
719
+ <span class='ivar'>@lipidos</span>
720
+ <span class='kw'>end</span></pre>
721
+ </td>
722
+ </tr>
723
+ </table>
724
+ </div>
725
+
726
+
727
+ <span id=""></span>
728
+ <div class="method_details ">
729
+ <h3 class="signature " id="nombre-instance_method">
730
+
731
+ #<strong>nombre</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
732
+
733
+
734
+
735
+
736
+
737
+ </h3><div class="docstring">
738
+ <div class="discussion">
739
+
740
+ <p>Los atributos son de lectura</p>
741
+
742
+
743
+ </div>
744
+ </div>
745
+ <div class="tags">
746
+
747
+
748
+ </div><table class="source_code">
749
+ <tr>
750
+ <td>
751
+ <pre class="lines">
752
+
753
+
754
+ 6
755
+ 7
756
+ 8</pre>
757
+ </td>
758
+ <td>
759
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 6</span>
760
+
761
+ <span class='kw'>def</span> <span class='id identifier rubyid_nombre'>nombre</span>
762
+ <span class='ivar'>@nombre</span>
763
+ <span class='kw'>end</span></pre>
764
+ </td>
765
+ </tr>
766
+ </table>
767
+ </div>
768
+
769
+
770
+ <span id=""></span>
771
+ <div class="method_details ">
772
+ <h3 class="signature " id="proteinas-instance_method">
773
+
774
+ #<strong>proteinas</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
775
+
776
+
777
+
778
+
779
+
780
+ </h3><div class="docstring">
781
+ <div class="discussion">
782
+
783
+ <p>Los atributos son de lectura</p>
784
+
785
+
786
+ </div>
787
+ </div>
788
+ <div class="tags">
789
+
790
+
791
+ </div><table class="source_code">
792
+ <tr>
793
+ <td>
794
+ <pre class="lines">
795
+
796
+
797
+ 6
798
+ 7
799
+ 8</pre>
800
+ </td>
801
+ <td>
802
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 6</span>
803
+
804
+ <span class='kw'>def</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
805
+ <span class='ivar'>@proteinas</span>
806
+ <span class='kw'>end</span></pre>
807
+ </td>
808
+ </tr>
809
+ </table>
810
+ </div>
811
+
812
+ </div>
813
+
814
+
815
+ <div id="instance_method_details" class="method_details_list">
816
+ <h2>Instance Method Details</h2>
817
+
818
+
819
+ <div class="method_details first">
820
+ <h3 class="signature first" id="<=>-instance_method">
821
+
822
+ #<strong>&lt;=&gt;</strong>(another) &#x21d2; <tt>Object</tt>
823
+
824
+
825
+
826
+
827
+
828
+ </h3><div class="docstring">
829
+ <div class="discussion">
830
+
831
+ <p>Sobreescritura de la funcion &lt;=&gt; de la clase Comparable para comparar
832
+ dos elementos</p>
833
+
834
+
835
+ </div>
836
+ </div>
837
+ <div class="tags">
838
+ <p class="tag_title">Parameters:</p>
839
+ <ul class="param">
840
+
841
+ <li>
842
+
843
+ <span class='name'>another</span>
844
+
845
+
846
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Comida (class)">Comida</a></span></tt>)</span>
847
+
848
+
849
+
850
+ &mdash;
851
+ <div class='inline'>
852
+ <p>Alimento con el que se pretende comparar este alimento (el alimento que
853
+ proporcione mayor kilocalorias será mayor).</p>
854
+ </div>
855
+
856
+ </li>
857
+
858
+ </ul>
859
+
860
+
861
+ </div><table class="source_code">
862
+ <tr>
863
+ <td>
864
+ <pre class="lines">
865
+
866
+
867
+ 50
868
+ 51
869
+ 52
870
+ 53
871
+ 54
872
+ 55
873
+ 56</pre>
874
+ </td>
875
+ <td>
876
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 50</span>
877
+
878
+ <span class='kw'>def</span> <span class='op'>&lt;=&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_another'>another</span><span class='rparen'>)</span>
879
+ <span class='kw'>if</span> <span class='id identifier rubyid_another'>another</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='op'>==</span> <span class='const'><span class='object_link'><a href="" title="Comida (class)">Comida</a></span></span>
880
+ <span class='id identifier rubyid_aux1'>aux1</span><span class='op'>=</span> <span class='id identifier rubyid_kilocalorias'>kilocalorias</span>
881
+ <span class='id identifier rubyid_aux2'>aux2</span><span class='op'>=</span> <span class='id identifier rubyid_another'>another</span><span class='period'>.</span><span class='id identifier rubyid_kilocalorias'>kilocalorias</span>
882
+ <span class='id identifier rubyid_aux1'>aux1</span><span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_aux2'>aux2</span>
883
+ <span class='kw'>end</span>
884
+ <span class='kw'>end</span></pre>
885
+ </td>
886
+ </tr>
887
+ </table>
888
+ </div>
889
+
890
+ <div class="method_details ">
891
+ <h3 class="signature " id="kilocalorias-instance_method">
892
+
893
+ #<strong>kilocalorias</strong> &#x21d2; <tt>Double</tt>
894
+
895
+
896
+
897
+
898
+
899
+ </h3><div class="docstring">
900
+ <div class="discussion">
901
+
902
+ <p>Devuelve un double con las kilocalorias que proporciona el alimento</p>
903
+
904
+
905
+ </div>
906
+ </div>
907
+ <div class="tags">
908
+
909
+ <p class="tag_title">Returns:</p>
910
+ <ul class="return">
911
+
912
+ <li>
913
+
914
+
915
+ <span class='type'>(<tt>Double</tt>)</span>
916
+
917
+
918
+
919
+ &mdash;
920
+ <div class='inline'>
921
+ <p>Kilocalorias que devuelve el alimento.</p>
922
+ </div>
923
+
924
+ </li>
925
+
926
+ </ul>
927
+
928
+ </div><table class="source_code">
929
+ <tr>
930
+ <td>
931
+ <pre class="lines">
932
+
933
+
934
+ 41
935
+ 42
936
+ 43</pre>
937
+ </td>
938
+ <td>
939
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 41</span>
940
+
941
+ <span class='kw'>def</span> <span class='id identifier rubyid_kilocalorias'>kilocalorias</span>
942
+ <span class='lparen'>(</span><span class='lparen'>(</span><span class='ivar'>@proteinas</span><span class='op'>*</span> <span class='float'>4.0</span><span class='period'>.</span><span class='id identifier rubyid_to_d'>to_d</span><span class='rparen'>)</span><span class='op'>+</span> <span class='lparen'>(</span><span class='ivar'>@lipidos</span><span class='op'>*</span> <span class='float'>9.0</span><span class='period'>.</span><span class='id identifier rubyid_to_d'>to_d</span><span class='rparen'>)</span><span class='op'>+</span> <span class='lparen'>(</span><span class='ivar'>@carbohidratos</span><span class='op'>*</span> <span class='float'>4.0</span><span class='period'>.</span><span class='id identifier rubyid_to_d'>to_d</span><span class='rparen'>)</span><span class='rparen'>)</span>
943
+ <span class='kw'>end</span></pre>
944
+ </td>
945
+ </tr>
946
+ </table>
947
+ </div>
948
+
949
+ <div class="method_details ">
950
+ <h3 class="signature " id="resumen-instance_method">
951
+
952
+ #<strong>resumen</strong> &#x21d2; <tt>String</tt>
953
+
954
+
955
+
956
+
957
+
958
+ </h3><div class="docstring">
959
+ <div class="discussion">
960
+
961
+ <p>Devuelve un string con un resumen del alimento</p>
962
+
963
+
964
+ </div>
965
+ </div>
966
+ <div class="tags">
967
+
968
+ <p class="tag_title">Returns:</p>
969
+ <ul class="return">
970
+
971
+ <li>
972
+
973
+
974
+ <span class='type'>(<tt>String</tt>)</span>
975
+
976
+
977
+
978
+ &mdash;
979
+ <div class='inline'>
980
+ <p>Cadena del resumen del alimento.</p>
981
+ </div>
982
+
983
+ </li>
984
+
985
+ </ul>
986
+
987
+ </div><table class="source_code">
988
+ <tr>
989
+ <td>
990
+ <pre class="lines">
991
+
992
+
993
+ 27
994
+ 28
995
+ 29
996
+ 30
997
+ 31
998
+ 32
999
+ 33
1000
+ 34</pre>
1001
+ </td>
1002
+ <td>
1003
+ <pre class="code"><span class="info file"># File 'lib/practica6/comida.rb', line 27</span>
1004
+
1005
+ <span class='kw'>def</span> <span class='id identifier rubyid_resumen'>resumen</span><span class='lparen'>(</span><span class='rparen'>)</span>
1006
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@nombre</span><span class='embexpr_end'>}</span><span class='tstring_content'>:\n
1007
+ -Proteinas:</span><span class='embexpr_beg'>#{</span><span class='ivar'>@proteinas</span><span class='embexpr_end'>}</span><span class='tstring_content'>g.\n
1008
+ -Carbohidratos:</span><span class='embexpr_beg'>#{</span><span class='ivar'>@carbohidratos</span><span class='embexpr_end'>}</span><span class='tstring_content'>g.\n
1009
+ -Lipidos:</span><span class='embexpr_beg'>#{</span><span class='ivar'>@lipidos</span><span class='embexpr_end'>}</span><span class='tstring_content'>g.\n
1010
+ -GEI:</span><span class='embexpr_beg'>#{</span><span class='ivar'>@GEI</span><span class='embexpr_end'>}</span><span class='tstring_content'>kgCO2eq.\n
1011
+ -Coste del terreno:</span><span class='embexpr_beg'>#{</span><span class='ivar'>@costeTerreno</span><span class='embexpr_end'>}</span><span class='tstring_content'>m2año.\n</span><span class='tstring_end'>&quot;</span></span>
1012
+ <span class='kw'>end</span></pre>
1013
+ </td>
1014
+ </tr>
1015
+ </table>
1016
+ </div>
1017
+
1018
+ </div>
1019
+
1020
+ </div>
1021
+
1022
+ <div id="footer">
1023
+ Generated on Tue Dec 17 19:32:04 2019 by
1024
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1025
+ 0.9.20 (ruby-2.5.1).
1026
+ </div>
1027
+
1028
+ </div>
1029
+ </body>
1030
+ </html>