kilocalorias_by_alu0100832211 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +14 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +6 -0
  7. data/Guardfile +82 -0
  8. data/README.md +21 -0
  9. data/Rakefile +6 -0
  10. data/bin/bundler +17 -0
  11. data/bin/console +14 -0
  12. data/bin/htmldiff +17 -0
  13. data/bin/ldiff +17 -0
  14. data/bin/rake +17 -0
  15. data/bin/rspec +17 -0
  16. data/bin/setup +8 -0
  17. data/docs/Alimento.html +972 -0
  18. data/docs/AlimentoGrasos.html +230 -0
  19. data/docs/AlimentoRicosEnCarbohidratos.html +230 -0
  20. data/docs/CarnesYDerivados.html +230 -0
  21. data/docs/Frutas.html +230 -0
  22. data/docs/HuevosLacteosHelados.html +230 -0
  23. data/docs/IG.html +928 -0
  24. data/docs/Kilocalorias.html +117 -0
  25. data/docs/LDE.html +1658 -0
  26. data/docs/LDE/Node.html +398 -0
  27. data/docs/PescadosYMariscos.html +230 -0
  28. data/docs/Plato.html +1527 -0
  29. data/docs/VerdurasYHortalizas.html +230 -0
  30. data/docs/_index.html +244 -0
  31. data/docs/class_list.html +51 -0
  32. data/docs/css/common.css +1 -0
  33. data/docs/css/full_list.css +58 -0
  34. data/docs/css/style.css +492 -0
  35. data/docs/file.README.html +100 -0
  36. data/docs/file_list.html +56 -0
  37. data/docs/frames.html +17 -0
  38. data/docs/index.html +100 -0
  39. data/docs/js/app.js +248 -0
  40. data/docs/js/full_list.js +216 -0
  41. data/docs/js/jquery.js +4 -0
  42. data/docs/method_list.html +603 -0
  43. data/docs/top-level-namespace.html +112 -0
  44. data/kilocalorias.gemspec +42 -0
  45. data/lib/kilocalorias.rb +6 -0
  46. data/lib/kilocalorias/alimento.rb +76 -0
  47. data/lib/kilocalorias/alimento_hijas.rb +57 -0
  48. data/lib/kilocalorias/ig.rb +101 -0
  49. data/lib/kilocalorias/lde.rb +227 -0
  50. data/lib/kilocalorias/plato.rb +186 -0
  51. data/lib/kilocalorias/version.rb +3 -0
  52. metadata +206 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7c8fc523e7a1174e016d76e5ee8dac38d5d9d783
4
+ data.tar.gz: 8f867dfa71840a7c2358a224d4f70dec7a2a7c03
5
+ SHA512:
6
+ metadata.gz: d6eab3859c6840ca116f2a71a501c913dbdbac45bb3e5268e9795e1c4b779c08998ddc6d46a389dc44e5943f6fa7ca6433d5b0c4b626d5611f588aaecc8532a0
7
+ data.tar.gz: 033525ba7b5960755b1acc423c42d232714d14d424e647a70c6894b39b054bd1769881c500d55c806117370ea8f603707e49465d8ae585628e8be63d0b6a335e
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ #/doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ *.ignorar
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.15.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in kilocalorias.gemspec
6
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,82 @@
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.exists?(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
+
45
+ # RSpec files
46
+ rspec = dsl.rspec
47
+ watch(rspec.spec_helper) { rspec.spec_dir }
48
+ watch(rspec.spec_support) { rspec.spec_dir }
49
+ watch(rspec.spec_files)
50
+
51
+ # Ruby files
52
+ ruby = dsl.ruby
53
+ dsl.watch_spec_files_for(ruby.lib_files)
54
+
55
+ # Rails files
56
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
57
+ dsl.watch_spec_files_for(rails.app_files)
58
+ dsl.watch_spec_files_for(rails.views)
59
+
60
+ watch(rails.controllers) do |m|
61
+ [
62
+ rspec.spec.call("routing/#{m[1]}_routing"),
63
+ rspec.spec.call("controllers/#{m[1]}_controller"),
64
+ rspec.spec.call("acceptance/#{m[1]}")
65
+ ]
66
+ end
67
+
68
+ # Rails config changes
69
+ watch(rails.spec_helper) { rspec.spec_dir }
70
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
71
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
72
+
73
+ # Capybara features specs
74
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
75
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
76
+
77
+ # Turnip features and steps
78
+ watch(%r{^spec/acceptance/(.+)\.feature$})
79
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
80
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
81
+ end
82
+ end
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Práctica de laboratorio #11 Lenguajes de dominio específico
2
+
3
+ Este repositorio contiene una gema desarrollada mediante la metodología TDD (Test Directed Development). Para ello se han implementado las correspondientes pruebas de rspec.
4
+
5
+
6
+ Las pruebas referentes a los métodos para ordenar la lista de alimentos y el benchmark están en spec/kilocalorias/lde_spec_rb
7
+
8
+ ### Ejecutando el programa
9
+ Para ejecutar guard, situarse en el directorio de la gema y ejecutar
10
+
11
+ ```
12
+ bundle exec guard
13
+ ```
14
+
15
+ ## Acceso a la documentación
16
+ [Página web](https://ull-esit-lpp-1718.github.io/tdd-alu0100832211/)
17
+
18
+ ## Autor
19
+ Gema escrita en lenguaje ruby.
20
+
21
+ * **Martín Belda Sosa** - *Lenguajes y paradigmas de la programación* - [alu0100832211](https://github.com/alu0100832211)
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/bundler ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'bundler' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("bundler", "bundler")
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "kilocalorias"
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/htmldiff ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'htmldiff' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("diff-lcs", "htmldiff")
data/bin/ldiff ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'ldiff' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("diff-lcs", "ldiff")
data/bin/rake ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rake", "rake")
data/bin/rspec ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rspec' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
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
@@ -0,0 +1,972 @@
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
+ &mdash; 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> &raquo;
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/kilocalorias/alimento.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <div id="subclasses">
108
+ <h2>Direct Known Subclasses</h2>
109
+ <p class="children"><span class='object_link'><a href="AlimentoGrasos.html" title="AlimentoGrasos (class)">AlimentoGrasos</a></span>, <span class='object_link'><a href="AlimentoRicosEnCarbohidratos.html" title="AlimentoRicosEnCarbohidratos (class)">AlimentoRicosEnCarbohidratos</a></span>, <span class='object_link'><a href="CarnesYDerivados.html" title="CarnesYDerivados (class)">CarnesYDerivados</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="PescadosYMariscos.html" title="PescadosYMariscos (class)">PescadosYMariscos</a></span>, <span class='object_link'><a href="VerdurasYHortalizas.html" title="VerdurasYHortalizas (class)">VerdurasYHortalizas</a></span></p>
110
+ </div>
111
+
112
+
113
+
114
+
115
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
116
+ <ul class="summary">
117
+
118
+ <li class="public ">
119
+ <span class="summary_signature">
120
+
121
+ <a href="#gramos-instance_method" title="#gramos (instance method)">#<strong>gramos</strong> &#x21d2; Object </a>
122
+
123
+
124
+
125
+ </span>
126
+
127
+
128
+
129
+
130
+ <span class="note title readonly">readonly</span>
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <span class="summary_desc"><div class='inline'>
141
+ <p>Returns the value of attribute gramos.</p>
142
+ </div></span>
143
+
144
+ </li>
145
+
146
+
147
+ <li class="public ">
148
+ <span class="summary_signature">
149
+
150
+ <a href="#n-instance_method" title="#n (instance method)">#<strong>n</strong> &#x21d2; Object </a>
151
+
152
+
153
+
154
+ </span>
155
+
156
+
157
+
158
+
159
+ <span class="note title readonly">readonly</span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'>
170
+ <p>Returns the value of attribute n.</p>
171
+ </div></span>
172
+
173
+ </li>
174
+
175
+
176
+ <li class="public ">
177
+ <span class="summary_signature">
178
+
179
+ <a href="#nombre-instance_method" title="#nombre (instance method)">#<strong>nombre</strong> &#x21d2; Object </a>
180
+
181
+
182
+
183
+ </span>
184
+
185
+
186
+
187
+
188
+ <span class="note title readonly">readonly</span>
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <span class="summary_desc"><div class='inline'>
199
+ <p>Returns the value of attribute nombre.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ </ul>
206
+
207
+
208
+
209
+
210
+
211
+ <h2>
212
+ Instance Method Summary
213
+ <small><a href="#" class="summary_toggle">collapse</a></small>
214
+ </h2>
215
+
216
+ <ul class="summary">
217
+
218
+ <li class="public ">
219
+ <span class="summary_signature">
220
+
221
+ <a href="#<=>-instance_method" title="#&lt;=&gt; (instance method)">#<strong>&lt;=&gt;</strong>(other) &#x21d2; Object </a>
222
+
223
+
224
+
225
+ </span>
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ <span class="summary_desc"><div class='inline'></div></span>
236
+
237
+ </li>
238
+
239
+
240
+ <li class="public ">
241
+ <span class="summary_signature">
242
+
243
+ <a href="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(nombre) &#x21d2; Object </a>
244
+
245
+
246
+
247
+ </span>
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+ <span class="summary_desc"><div class='inline'></div></span>
258
+
259
+ </li>
260
+
261
+
262
+ <li class="public ">
263
+ <span class="summary_signature">
264
+
265
+ <a href="#glucidos-instance_method" title="#glucidos (instance method)">#<strong>glucidos</strong> &#x21d2; Object </a>
266
+
267
+
268
+
269
+ </span>
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ <span class="summary_desc"><div class='inline'></div></span>
280
+
281
+ </li>
282
+
283
+
284
+ <li class="public ">
285
+ <span class="summary_signature">
286
+
287
+ <a href="#ig-instance_method" title="#ig (instance method)">#<strong>ig</strong> &#x21d2; Object </a>
288
+
289
+
290
+
291
+ </span>
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+ <span class="summary_desc"><div class='inline'>
302
+ <p>Método getter para el índice glucémico.</p>
303
+ </div></span>
304
+
305
+ </li>
306
+
307
+
308
+ <li class="public ">
309
+ <span class="summary_signature">
310
+
311
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(nombre, gramos) &#x21d2; Alimento </a>
312
+
313
+
314
+
315
+ </span>
316
+
317
+
318
+ <span class="note title constructor">constructor</span>
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+ <span class="summary_desc"><div class='inline'>
328
+ <p>A new instance of Alimento.</p>
329
+ </div></span>
330
+
331
+ </li>
332
+
333
+
334
+ <li class="public ">
335
+ <span class="summary_signature">
336
+
337
+ <a href="#insertar_intervalos_alimento_glucosa-instance_method" title="#insertar_intervalos_alimento_glucosa (instance method)">#<strong>insertar_intervalos_alimento_glucosa</strong>(alim, gluc) &#x21d2; Object </a>
338
+
339
+
340
+
341
+ </span>
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+ <span class="summary_desc"><div class='inline'></div></span>
352
+
353
+ </li>
354
+
355
+
356
+ <li class="public ">
357
+ <span class="summary_signature">
358
+
359
+ <a href="#kilocalorias-instance_method" title="#kilocalorias (instance method)">#<strong>kilocalorias</strong> &#x21d2; Object </a>
360
+
361
+
362
+
363
+ </span>
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+ <span class="summary_desc"><div class='inline'></div></span>
374
+
375
+ </li>
376
+
377
+
378
+ <li class="public ">
379
+ <span class="summary_signature">
380
+
381
+ <a href="#lipidos-instance_method" title="#lipidos (instance method)">#<strong>lipidos</strong> &#x21d2; Object </a>
382
+
383
+
384
+
385
+ </span>
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+ <span class="summary_desc"><div class='inline'></div></span>
396
+
397
+ </li>
398
+
399
+
400
+ <li class="public ">
401
+ <span class="summary_signature">
402
+
403
+ <a href="#proteinas-instance_method" title="#proteinas (instance method)">#<strong>proteinas</strong> &#x21d2; Object </a>
404
+
405
+
406
+
407
+ </span>
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+ <span class="summary_desc"><div class='inline'></div></span>
418
+
419
+ </li>
420
+
421
+
422
+ <li class="public ">
423
+ <span class="summary_signature">
424
+
425
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
426
+
427
+
428
+
429
+ </span>
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+ <span class="summary_desc"><div class='inline'></div></span>
440
+
441
+ </li>
442
+
443
+
444
+ </ul>
445
+
446
+
447
+
448
+ <div id="constructor_details" class="method_details_list">
449
+ <h2>Constructor Details</h2>
450
+
451
+ <div class="method_details first">
452
+ <h3 class="signature first" id="initialize-instance_method">
453
+
454
+ #<strong>initialize</strong>(nombre, gramos) &#x21d2; <tt><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></tt>
455
+
456
+
457
+
458
+
459
+
460
+ </h3><div class="docstring">
461
+ <div class="discussion">
462
+
463
+ <p>Returns a new instance of Alimento</p>
464
+
465
+
466
+ </div>
467
+ </div>
468
+ <div class="tags">
469
+
470
+
471
+ </div><table class="source_code">
472
+ <tr>
473
+ <td>
474
+ <pre class="lines">
475
+
476
+
477
+ 9
478
+ 10
479
+ 11
480
+ 12
481
+ 13
482
+ 14
483
+ 15</pre>
484
+ </td>
485
+ <td>
486
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 9</span>
487
+
488
+ <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_gramos'>gramos</span><span class='rparen'>)</span>
489
+
490
+ <span class='ivar'>@nombre</span> <span class='op'>=</span> <span class='id identifier rubyid_nombre'>nombre</span>
491
+ <span class='ivar'>@gramos</span> <span class='op'>=</span> <span class='id identifier rubyid_gramos'>gramos</span>
492
+ <span class='comment'>#índice glucémico
493
+ </span> <span class='ivar'>@ig</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="IG.html" title="IG (class)">IG</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="IG.html#initialize-instance_method" title="IG#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_nombre'>nombre</span><span class='comma'>,</span><span class='int'>5</span><span class='rparen'>)</span>
494
+ <span class='kw'>end</span></pre>
495
+ </td>
496
+ </tr>
497
+ </table>
498
+ </div>
499
+
500
+ </div>
501
+
502
+ <div id="instance_attr_details" class="attr_details">
503
+ <h2>Instance Attribute Details</h2>
504
+
505
+
506
+ <span id=""></span>
507
+ <div class="method_details first">
508
+ <h3 class="signature first" id="gramos-instance_method">
509
+
510
+ #<strong>gramos</strong> &#x21d2; <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 gramos</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
+ 7
534
+ 8
535
+ 9</pre>
536
+ </td>
537
+ <td>
538
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 7</span>
539
+
540
+ <span class='kw'>def</span> <span class='id identifier rubyid_gramos'>gramos</span>
541
+ <span class='ivar'>@gramos</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="n-instance_method">
552
+
553
+ #<strong>n</strong> &#x21d2; <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 n</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
+ 7
577
+ 8
578
+ 9</pre>
579
+ </td>
580
+ <td>
581
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 7</span>
582
+
583
+ <span class='kw'>def</span> <span class='id identifier rubyid_n'>n</span>
584
+ <span class='ivar'>@n</span>
585
+ <span class='kw'>end</span></pre>
586
+ </td>
587
+ </tr>
588
+ </table>
589
+ </div>
590
+
591
+
592
+ <span id=""></span>
593
+ <div class="method_details ">
594
+ <h3 class="signature " id="nombre-instance_method">
595
+
596
+ #<strong>nombre</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
597
+
598
+
599
+
600
+
601
+
602
+ </h3><div class="docstring">
603
+ <div class="discussion">
604
+
605
+ <p>Returns the value of attribute nombre</p>
606
+
607
+
608
+ </div>
609
+ </div>
610
+ <div class="tags">
611
+
612
+
613
+ </div><table class="source_code">
614
+ <tr>
615
+ <td>
616
+ <pre class="lines">
617
+
618
+
619
+ 7
620
+ 8
621
+ 9</pre>
622
+ </td>
623
+ <td>
624
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 7</span>
625
+
626
+ <span class='kw'>def</span> <span class='id identifier rubyid_nombre'>nombre</span>
627
+ <span class='ivar'>@nombre</span>
628
+ <span class='kw'>end</span></pre>
629
+ </td>
630
+ </tr>
631
+ </table>
632
+ </div>
633
+
634
+ </div>
635
+
636
+
637
+ <div id="instance_method_details" class="method_details_list">
638
+ <h2>Instance Method Details</h2>
639
+
640
+
641
+ <div class="method_details first">
642
+ <h3 class="signature first" id="<=>-instance_method">
643
+
644
+ #<strong>&lt;=&gt;</strong>(other) &#x21d2; <tt>Object</tt>
645
+
646
+
647
+
648
+
649
+
650
+ </h3><table class="source_code">
651
+ <tr>
652
+ <td>
653
+ <pre class="lines">
654
+
655
+
656
+ 47
657
+ 48
658
+ 49
659
+ 50
660
+ 51</pre>
661
+ </td>
662
+ <td>
663
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 47</span>
664
+
665
+ <span class='kw'>def</span> <span class='op'>&lt;=&gt;</span> <span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
666
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_instance_of?'>instance_of?</span> <span class='const'><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></span>
667
+
668
+ <span class='id identifier rubyid_kilocalorias'>kilocalorias</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_kilocalorias'>kilocalorias</span>
669
+ <span class='kw'>end</span></pre>
670
+ </td>
671
+ </tr>
672
+ </table>
673
+ </div>
674
+
675
+ <div class="method_details ">
676
+ <h3 class="signature " id="==-instance_method">
677
+
678
+ #<strong>==</strong>(nombre) &#x21d2; <tt>Object</tt>
679
+
680
+
681
+
682
+
683
+
684
+ </h3><table class="source_code">
685
+ <tr>
686
+ <td>
687
+ <pre class="lines">
688
+
689
+
690
+ 53
691
+ 54
692
+ 55
693
+ 56
694
+ 57
695
+ 58
696
+ 59
697
+ 60
698
+ 61
699
+ 62
700
+ 63
701
+ 64
702
+ 65
703
+ 66
704
+ 67
705
+ 68</pre>
706
+ </td>
707
+ <td>
708
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 53</span>
709
+
710
+ <span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_nombre'>nombre</span><span class='rparen'>)</span>
711
+ <span class='comment'>#creando vectores para cada alimento
712
+ </span><span class='embdoc_beg'>=begin
713
+ </span><span class='embdoc'> lhs = [@nombre, proteinas, lipidos, glucidos]
714
+ </span><span class='embdoc'>
715
+ </span><span class='embdoc'> v1 = other.nombre
716
+ </span><span class='embdoc'> v2 = other.proteinas
717
+ </span><span class='embdoc'> v3 = other.lipidos
718
+ </span><span class='embdoc'> v4 = other.glucidos
719
+ </span><span class='embdoc'>
720
+ </span><span class='embdoc'> rhs = [v1, v2, v3, v4]
721
+ </span><span class='embdoc'>
722
+ </span><span class='embdoc'> lhs == rhs
723
+ </span><span class='embdoc_end'>=end
724
+ </span> <span class='ivar'>@nombre</span> <span class='op'>==</span><span class='id identifier rubyid_nombre'>nombre</span>
725
+ <span class='kw'>end</span></pre>
726
+ </td>
727
+ </tr>
728
+ </table>
729
+ </div>
730
+
731
+ <div class="method_details ">
732
+ <h3 class="signature " id="glucidos-instance_method">
733
+
734
+ #<strong>glucidos</strong> &#x21d2; <tt>Object</tt>
735
+
736
+
737
+
738
+
739
+
740
+ </h3><table class="source_code">
741
+ <tr>
742
+ <td>
743
+ <pre class="lines">
744
+
745
+
746
+ 30
747
+ 31
748
+ 32</pre>
749
+ </td>
750
+ <td>
751
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 30</span>
752
+
753
+ <span class='kw'>def</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
754
+ <span class='id identifier rubyid_gramos'>gramos</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
755
+ <span class='kw'>end</span></pre>
756
+ </td>
757
+ </tr>
758
+ </table>
759
+ </div>
760
+
761
+ <div class="method_details ">
762
+ <h3 class="signature " id="ig-instance_method">
763
+
764
+ #<strong>ig</strong> &#x21d2; <tt>Object</tt>
765
+
766
+
767
+
768
+
769
+
770
+ </h3><div class="docstring">
771
+ <div class="discussion">
772
+
773
+ <p>Método getter para el índice glucémico</p>
774
+
775
+
776
+ </div>
777
+ </div>
778
+ <div class="tags">
779
+
780
+
781
+ </div><table class="source_code">
782
+ <tr>
783
+ <td>
784
+ <pre class="lines">
785
+
786
+
787
+ 18
788
+ 19
789
+ 20</pre>
790
+ </td>
791
+ <td>
792
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 18</span>
793
+
794
+ <span class='kw'>def</span> <span class='id identifier rubyid_ig'>ig</span>
795
+ <span class='ivar'>@ig</span><span class='period'>.</span><span class='id identifier rubyid_ig'>ig</span>
796
+ <span class='kw'>end</span></pre>
797
+ </td>
798
+ </tr>
799
+ </table>
800
+ </div>
801
+
802
+ <div class="method_details ">
803
+ <h3 class="signature " id="insertar_intervalos_alimento_glucosa-instance_method">
804
+
805
+ #<strong>insertar_intervalos_alimento_glucosa</strong>(alim, gluc) &#x21d2; <tt>Object</tt>
806
+
807
+
808
+
809
+
810
+
811
+ </h3><table class="source_code">
812
+ <tr>
813
+ <td>
814
+ <pre class="lines">
815
+
816
+
817
+ 70
818
+ 71
819
+ 72</pre>
820
+ </td>
821
+ <td>
822
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 70</span>
823
+
824
+ <span class='kw'>def</span> <span class='id identifier rubyid_insertar_intervalos_alimento_glucosa'>insertar_intervalos_alimento_glucosa</span><span class='lparen'>(</span><span class='id identifier rubyid_alim'>alim</span><span class='comma'>,</span> <span class='id identifier rubyid_gluc'>gluc</span><span class='rparen'>)</span>
825
+ <span class='ivar'>@ig</span><span class='period'>.</span><span class='id identifier rubyid_insertar_intervalos_alimento_glucosa'>insertar_intervalos_alimento_glucosa</span><span class='lparen'>(</span><span class='id identifier rubyid_alim'>alim</span><span class='comma'>,</span> <span class='id identifier rubyid_gluc'>gluc</span><span class='rparen'>)</span>
826
+ <span class='kw'>end</span></pre>
827
+ </td>
828
+ </tr>
829
+ </table>
830
+ </div>
831
+
832
+ <div class="method_details ">
833
+ <h3 class="signature " id="kilocalorias-instance_method">
834
+
835
+ #<strong>kilocalorias</strong> &#x21d2; <tt>Object</tt>
836
+
837
+
838
+
839
+
840
+
841
+ </h3><table class="source_code">
842
+ <tr>
843
+ <td>
844
+ <pre class="lines">
845
+
846
+
847
+ 43
848
+ 44
849
+ 45</pre>
850
+ </td>
851
+ <td>
852
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 43</span>
853
+
854
+ <span class='kw'>def</span> <span class='id identifier rubyid_kilocalorias'>kilocalorias</span>
855
+ <span class='id identifier rubyid_gramos'>gramos</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='op'>*</span><span class='int'>4</span><span class='op'>+</span><span class='id identifier rubyid_gramos'>gramos</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='op'>*</span><span class='int'>9</span><span class='op'>+</span><span class='id identifier rubyid_gramos'>gramos</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='op'>*</span><span class='int'>4</span>
856
+ <span class='kw'>end</span></pre>
857
+ </td>
858
+ </tr>
859
+ </table>
860
+ </div>
861
+
862
+ <div class="method_details ">
863
+ <h3 class="signature " id="lipidos-instance_method">
864
+
865
+ #<strong>lipidos</strong> &#x21d2; <tt>Object</tt>
866
+
867
+
868
+
869
+
870
+
871
+ </h3><table class="source_code">
872
+ <tr>
873
+ <td>
874
+ <pre class="lines">
875
+
876
+
877
+ 26
878
+ 27
879
+ 28</pre>
880
+ </td>
881
+ <td>
882
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 26</span>
883
+
884
+ <span class='kw'>def</span> <span class='id identifier rubyid_lipidos'>lipidos</span>
885
+ <span class='id identifier rubyid_gramos'>gramos</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
886
+ <span class='kw'>end</span></pre>
887
+ </td>
888
+ </tr>
889
+ </table>
890
+ </div>
891
+
892
+ <div class="method_details ">
893
+ <h3 class="signature " id="proteinas-instance_method">
894
+
895
+ #<strong>proteinas</strong> &#x21d2; <tt>Object</tt>
896
+
897
+
898
+
899
+
900
+
901
+ </h3><table class="source_code">
902
+ <tr>
903
+ <td>
904
+ <pre class="lines">
905
+
906
+
907
+ 22
908
+ 23
909
+ 24</pre>
910
+ </td>
911
+ <td>
912
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 22</span>
913
+
914
+ <span class='kw'>def</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
915
+ <span class='id identifier rubyid_gramos'>gramos</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
916
+ <span class='kw'>end</span></pre>
917
+ </td>
918
+ </tr>
919
+ </table>
920
+ </div>
921
+
922
+ <div class="method_details ">
923
+ <h3 class="signature " id="to_s-instance_method">
924
+
925
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
926
+
927
+
928
+
929
+
930
+
931
+ </h3><table class="source_code">
932
+ <tr>
933
+ <td>
934
+ <pre class="lines">
935
+
936
+
937
+ 35
938
+ 36
939
+ 37
940
+ 38
941
+ 39
942
+ 40
943
+ 41</pre>
944
+ </td>
945
+ <td>
946
+ <pre class="code"><span class="info file"># File 'lib/kilocalorias/alimento.rb', line 35</span>
947
+
948
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
949
+ <span class='kw'>if</span> <span class='ivar'>@nombre</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Ternera</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
950
+ <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'>\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_proteinas'>proteinas</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_glucidos'>glucidos</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g\t\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lipidos'>lipidos</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_kilocalorias'>kilocalorias</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g</span><span class='tstring_end'>&quot;</span></span>
951
+ <span class='kw'>else</span>
952
+ <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'>\t\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_proteinas'>proteinas</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_glucidos'>glucidos</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lipidos'>lipidos</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g\t\t</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_kilocalorias'>kilocalorias</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>g</span><span class='tstring_end'>&quot;</span></span>
953
+ <span class='kw'>end</span>
954
+ <span class='kw'>end</span></pre>
955
+ </td>
956
+ </tr>
957
+ </table>
958
+ </div>
959
+
960
+ </div>
961
+
962
+ </div>
963
+
964
+ <div id="footer">
965
+ Generated on Tue Dec 12 15:09:22 2017 by
966
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
967
+ 0.9.9 (ruby-2.4.2).
968
+ </div>
969
+
970
+ </div>
971
+ </body>
972
+ </html>