ALU0100893649_ALIMENTO 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +11 -0
- data/.travis.yml +5 -0
- data/Alimento.gemspec +41 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +66 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/ALU0100893649_ALIMENTO.html +133 -0
- data/docs/Alimento.html +1379 -0
- data/docs/AlimentoCategorizable.html +773 -0
- data/docs/GrupoAlimenticio.html +960 -0
- data/docs/Lista.html +1246 -0
- data/docs/Node.html +441 -0
- data/docs/_index.html +156 -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 +167 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +167 -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 +331 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/Alimento.rb +11 -0
- data/lib/alimento/Alimento.rb +65 -0
- data/lib/alimento/AlimentoCategorizable.rb +33 -0
- data/lib/alimento/GrupoAlimenticio.rb +63 -0
- data/lib/alimento/Lista.rb +110 -0
- data/lib/alimento/PlatoHarvard.rb +93 -0
- data/lib/alimento/version.rb +29 -0
- metadata +181 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 51d15a68bd33ec8e1b1416372278b61b9655a702
|
|
4
|
+
data.tar.gz: cfa705bcb8e1d86edde92506874d7c1cac74a862
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: db01b36ac56e34297986684dc7dcdfca5ff7a2f4c13bc6bedeab613f31a83d92ed776a2e8d24338ce93c8e42ad1c9e1da0068c22fdcee376ce7f5bee630bf2c7
|
|
7
|
+
data.tar.gz: 452fc212fb6fb6d8aca50df51241bff56c40cf2ce2c742f265d24cf70ed086f2ef008d8c5f3973a426682905067b5d0d883abb8390cd406e941d090e1d834d25
|
data/.coveralls.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Alimento.gemspec
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "alimento/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ALU0100893649_ALIMENTO"
|
|
8
|
+
spec.version = Alimento::VERSION
|
|
9
|
+
spec.authors = ["Sebastian Diaz"]
|
|
10
|
+
spec.email = ["alu0100893649@ull.edu.es"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{"Clase para gestionar los glúcidos, lípidos y proteínas de un alimento específico"}
|
|
13
|
+
spec.homepage = "https://github.com/alu0100893649/tdd-alu0100893649"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
18
|
+
if spec.respond_to?(:metadata)
|
|
19
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
|
20
|
+
else
|
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
22
|
+
"public gem pushes."
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
|
27
|
+
end
|
|
28
|
+
spec.bindir = "exe"
|
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
35
|
+
|
|
36
|
+
spec.add_development_dependency "guard"
|
|
37
|
+
spec.add_development_dependency "guard-rspec"
|
|
38
|
+
spec.add_development_dependency "guard-bundler"
|
|
39
|
+
spec.add_development_dependency "coveralls"
|
|
40
|
+
|
|
41
|
+
end
|
data/Gemfile
ADDED
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/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Sebastian Diaz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Alimento
|
|
2
|
+
|
|
3
|
+
La gema Alimento contiene la clase alimento, la cual permite la creación de un objeto Alimento con un identificador literal y unas componentes
|
|
4
|
+
basadas en los glúcidos, lípidos y proteínas para gestionar las calorías proporcionadas por este.
|
|
5
|
+
|
|
6
|
+
## Instalación
|
|
7
|
+
|
|
8
|
+
Añade esta línea a tu documento Gemgfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'Alimento'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
y ejecuta el comando:
|
|
15
|
+
|
|
16
|
+
$ bundle
|
|
17
|
+
|
|
18
|
+
O realiza una instalación directa con:
|
|
19
|
+
|
|
20
|
+
$ gem install Alimento
|
|
21
|
+
|
|
22
|
+
## Detalles de las clases
|
|
23
|
+
|
|
24
|
+
### Alimento
|
|
25
|
+
- Creacion de Alimento: Alimento.new(Nombre, gr glúcidos, gr proteínas, gr lípidos).
|
|
26
|
+
- Tiene métodos para el acceso de lectura a los atributos _nombre_, _glucidos_, _proteinas_ y _lipidos_.
|
|
27
|
+
- kcal: método para el cálculo. Devuelve el valor energético del alimento en kilocalorías.
|
|
28
|
+
- Puede calcular el índice glucémico de un alimento a partir de los datos del experimento
|
|
29
|
+
- Es comparable
|
|
30
|
+
|
|
31
|
+
### AlimentoCategorizable
|
|
32
|
+
- Creacion de AlimentoCategorizable: AlimentoCategorizable.new(Nombre, categoria, gr glúcidos, gr proteínas, gr lípidos)
|
|
33
|
+
- Hereda la funcionalidad de Alimento
|
|
34
|
+
- Tiene un atributo _categoria_, su grupo alimenticio, y métodos para su acceso de lectura
|
|
35
|
+
|
|
36
|
+
### Node
|
|
37
|
+
- Creacion de Node: Node.new(valor, nodo siguiente, nodo previo).
|
|
38
|
+
- Tiene métodos de acceso y modificación de los atributos _value_, _next_ y _prev_.
|
|
39
|
+
|
|
40
|
+
### Lista
|
|
41
|
+
- Creacion de Lista: Lista.new()
|
|
42
|
+
- Tiene métodos de acceso para sus atributos _head_ y _tail_, lo que permite hacer comprobación del contenido previa sustracción o inserción.
|
|
43
|
+
- Tiene métodos para la extracción (*pop_head*, *pop_tail*) para eliminar un nodo de la lista y obtener su contenido (su valor Node.value).
|
|
44
|
+
- Tiene métodos para la inserción de elementos (*push_head(x)*, *push_tail*) para la inclusión de un nodo en la lista.
|
|
45
|
+
- Es enumerable
|
|
46
|
+
|
|
47
|
+
### GrupoAlimenticio
|
|
48
|
+
- Creacion de GrupoAlimenticio: GrupoAlimenticio.new(Categoria).
|
|
49
|
+
- Hereda su funcionalidad de la lista
|
|
50
|
+
- Tiene un atributo _categoria_ que define la categoria de los alimentos que se meten en la lista, y su método de lectura
|
|
51
|
+
|
|
52
|
+
### Plato de Harvard
|
|
53
|
+
- Implementación de un DSL para la gestión de un plato de Harvard
|
|
54
|
+
|
|
55
|
+
## Licencia
|
|
56
|
+
|
|
57
|
+
La gema está disponible como código abierto bajo los términos de la [Licencia MIT](http://opensource.org/licenses/MIT).
|
|
58
|
+
|
|
59
|
+
## Sincronización con Travis CI
|
|
60
|
+
|
|
61
|
+
Está sincronizado con Travis
|
|
62
|
+
|
|
63
|
+
#### Implementación de Benchmark para comprobación de eficiencia de for, each y sort
|
|
64
|
+
|
|
65
|
+
[](https://coveralls.io/github/alu0100893649/tdd-alu0100893649?branch=master)
|
|
66
|
+
[](https://travis-ci.com/alu0100893649/tdd-alu0100893649)
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "Alimento"
|
|
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,133 @@
|
|
|
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
|
+
Module: ALU0100893649_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 = "ALU0100893649_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">ALU0100893649_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>Module: ALU0100893649_ALIMENTO
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<dl>
|
|
80
|
+
<dt>Defined in:</dt>
|
|
81
|
+
<dd>lib/Alimento.rb</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
|
87
|
+
<div class="discussion">
|
|
88
|
+
|
|
89
|
+
<p>Espacio de nombre que contiene las clases y metodos para el manejo de
|
|
90
|
+
listas, nodos, alimentos y grupos de alimentos</p>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div class="tags">
|
|
96
|
+
|
|
97
|
+
<p class="tag_title">Since:</p>
|
|
98
|
+
<ul class="since">
|
|
99
|
+
|
|
100
|
+
<li>
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<div class='inline'>
|
|
107
|
+
<p>1.0.0</p>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
</li>
|
|
111
|
+
|
|
112
|
+
</ul>
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<div id="footer">
|
|
126
|
+
Generated on Fri Nov 24 11:12:15 2017 by
|
|
127
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
128
|
+
0.9.9 (ruby-2.3.4).
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
</body>
|
|
133
|
+
</html>
|
data/docs/Alimento.html
ADDED
|
@@ -0,0 +1,1379 @@
|
|
|
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/alimento/Alimento.rb<span class="defines">,<br />
|
|
103
|
+
lib/alimento/version.rb</span>
|
|
104
|
+
</dd>
|
|
105
|
+
</dl>
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<h2>Overview</h2><div class="docstring">
|
|
110
|
+
<div class="discussion">
|
|
111
|
+
|
|
112
|
+
<p>Representación de un alimento según sus calorías aportadas y la cantidad de
|
|
113
|
+
glucidos, proteinas y lipidos contenidos</p>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="tags">
|
|
119
|
+
|
|
120
|
+
<p class="tag_title">Author:</p>
|
|
121
|
+
<ul class="author">
|
|
122
|
+
|
|
123
|
+
<li>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<div class='inline'>
|
|
130
|
+
<p>Sebastian Jose Diaz Rodriguez</p>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
</li>
|
|
134
|
+
|
|
135
|
+
</ul>
|
|
136
|
+
<p class="tag_title">Since:</p>
|
|
137
|
+
<ul class="since">
|
|
138
|
+
|
|
139
|
+
<li>
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
<div class='inline'>
|
|
146
|
+
<p>1.0.0</p>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
</li>
|
|
150
|
+
|
|
151
|
+
</ul>
|
|
152
|
+
|
|
153
|
+
</div><div id="subclasses">
|
|
154
|
+
<h2>Direct Known Subclasses</h2>
|
|
155
|
+
<p class="children"><span class='object_link'><a href="AlimentoCategorizable.html" title="AlimentoCategorizable (class)">AlimentoCategorizable</a></span></p>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<h2>Constant Summary</h2>
|
|
159
|
+
<dl class="constants">
|
|
160
|
+
|
|
161
|
+
<dt id="VERSION-constant" class="">VERSION =
|
|
162
|
+
<div class="docstring">
|
|
163
|
+
<div class="discussion">
|
|
164
|
+
|
|
165
|
+
<p>Version de la clase Alimento</p>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
<div class="tags">
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
</div>
|
|
174
|
+
</dt>
|
|
175
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1.1.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
176
|
+
|
|
177
|
+
</dl>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
183
|
+
<ul class="summary">
|
|
184
|
+
|
|
185
|
+
<li class="public ">
|
|
186
|
+
<span class="summary_signature">
|
|
187
|
+
|
|
188
|
+
<a href="#glucidos-instance_method" title="#glucidos (instance method)">#<strong>glucidos</strong> ⇒ Object </a>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
</span>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<span class="note title readonly">readonly</span>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
208
|
+
|
|
209
|
+
</li>
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
<li class="public ">
|
|
213
|
+
<span class="summary_signature">
|
|
214
|
+
|
|
215
|
+
<a href="#lipidos-instance_method" title="#lipidos (instance method)">#<strong>lipidos</strong> ⇒ Object </a>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
</span>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
<span class="note title readonly">readonly</span>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
235
|
+
|
|
236
|
+
</li>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<li class="public ">
|
|
240
|
+
<span class="summary_signature">
|
|
241
|
+
|
|
242
|
+
<a href="#nombre-instance_method" title="#nombre (instance method)">#<strong>nombre</strong> ⇒ Object </a>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
</span>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
<span class="note title readonly">readonly</span>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
262
|
+
|
|
263
|
+
</li>
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
<li class="public ">
|
|
267
|
+
<span class="summary_signature">
|
|
268
|
+
|
|
269
|
+
<a href="#Number-instance_method" title="#Number (instance method)">#<strong>Number</strong> ⇒ Object </a>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
</span>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
<span class="note title readonly">readonly</span>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<span class="summary_desc"><div class='inline'>
|
|
289
|
+
<p>glucidos glucidos contenidos en el alimento.</p>
|
|
290
|
+
</div></span>
|
|
291
|
+
|
|
292
|
+
</li>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<li class="public ">
|
|
296
|
+
<span class="summary_signature">
|
|
297
|
+
|
|
298
|
+
<a href="#proteinas-instance_method" title="#proteinas (instance method)">#<strong>proteinas</strong> ⇒ Object </a>
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
</span>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
<span class="note title readonly">readonly</span>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
318
|
+
|
|
319
|
+
</li>
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<li class="public ">
|
|
323
|
+
<span class="summary_signature">
|
|
324
|
+
|
|
325
|
+
<a href="#String-instance_method" title="#String (instance method)">#<strong>String</strong> ⇒ Object </a>
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
</span>
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
<span class="note title readonly">readonly</span>
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
<span class="summary_desc"><div class='inline'>
|
|
345
|
+
<p>nombre Nombre del alimento.</p>
|
|
346
|
+
</div></span>
|
|
347
|
+
|
|
348
|
+
</li>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
</ul>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
<h2>
|
|
358
|
+
Instance Method Summary
|
|
359
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
360
|
+
</h2>
|
|
361
|
+
|
|
362
|
+
<ul class="summary">
|
|
363
|
+
|
|
364
|
+
<li class="public ">
|
|
365
|
+
<span class="summary_signature">
|
|
366
|
+
|
|
367
|
+
<a href="#<=>-instance_method" title="#<=> (instance method)">#<strong><=></strong>(other) ⇒ Number </a>
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
</span>
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
<span class="summary_desc"><div class='inline'>
|
|
382
|
+
<p>Constructor de Alimento.</p>
|
|
383
|
+
</div></span>
|
|
384
|
+
|
|
385
|
+
</li>
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
<li class="public ">
|
|
389
|
+
<span class="summary_signature">
|
|
390
|
+
|
|
391
|
+
<a href="#calculate_index-instance_method" title="#calculate_index (instance method)">#<strong>calculate_index</strong>(alimento, glucosa) ⇒ Float </a>
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
</span>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
<span class="summary_desc"><div class='inline'>
|
|
406
|
+
<p>Método para calcular el índice glucémico.</p>
|
|
407
|
+
</div></span>
|
|
408
|
+
|
|
409
|
+
</li>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
<li class="public ">
|
|
413
|
+
<span class="summary_signature">
|
|
414
|
+
|
|
415
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(nombre, glucidos, proteinas, lipidos) ⇒ Alimento </a>
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
</span>
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
<span class="note title constructor">constructor</span>
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
<span class="summary_desc"><div class='inline'>
|
|
432
|
+
<p>Constructor de Alimento.</p>
|
|
433
|
+
</div></span>
|
|
434
|
+
|
|
435
|
+
</li>
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
<li class="public ">
|
|
439
|
+
<span class="summary_signature">
|
|
440
|
+
|
|
441
|
+
<a href="#kcal-instance_method" title="#kcal (instance method)">#<strong>kcal</strong> ⇒ Number </a>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
</span>
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
<span class="summary_desc"><div class='inline'>
|
|
456
|
+
<p>Constructor de Alimento.</p>
|
|
457
|
+
</div></span>
|
|
458
|
+
|
|
459
|
+
</li>
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
<li class="public ">
|
|
463
|
+
<span class="summary_signature">
|
|
464
|
+
|
|
465
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ String </a>
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
</span>
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
<span class="summary_desc"><div class='inline'>
|
|
480
|
+
<p>Convierte el objeto en un String.</p>
|
|
481
|
+
</div></span>
|
|
482
|
+
|
|
483
|
+
</li>
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
</ul>
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
<div id="constructor_details" class="method_details_list">
|
|
491
|
+
<h2>Constructor Details</h2>
|
|
492
|
+
|
|
493
|
+
<div class="method_details first">
|
|
494
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
495
|
+
|
|
496
|
+
#<strong>initialize</strong>(nombre, glucidos, proteinas, lipidos) ⇒ <tt><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></tt>
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
</h3><div class="docstring">
|
|
503
|
+
<div class="discussion">
|
|
504
|
+
|
|
505
|
+
<p>Constructor de Alimento</p>
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
</div>
|
|
509
|
+
</div>
|
|
510
|
+
<div class="tags">
|
|
511
|
+
<p class="tag_title">Parameters:</p>
|
|
512
|
+
<ul class="param">
|
|
513
|
+
|
|
514
|
+
<li>
|
|
515
|
+
|
|
516
|
+
<span class='name'>nombre</span>
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
<span class='type'>(<tt><span class='object_link'><a href="#String-instance_method" title="Alimento#String (method)">String</a></span></tt>)</span>
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
—
|
|
524
|
+
<div class='inline'>
|
|
525
|
+
<p>nombre del alimento</p>
|
|
526
|
+
</div>
|
|
527
|
+
|
|
528
|
+
</li>
|
|
529
|
+
|
|
530
|
+
<li>
|
|
531
|
+
|
|
532
|
+
<span class='name'>glucidos</span>
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
<span class='type'>(<tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>)</span>
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
—
|
|
540
|
+
<div class='inline'>
|
|
541
|
+
<p>glucidos contenidos en el alimento</p>
|
|
542
|
+
</div>
|
|
543
|
+
|
|
544
|
+
</li>
|
|
545
|
+
|
|
546
|
+
<li>
|
|
547
|
+
|
|
548
|
+
<span class='name'>proteinas</span>
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
<span class='type'>(<tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>)</span>
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
—
|
|
556
|
+
<div class='inline'>
|
|
557
|
+
<p>preoteinas contenidos en el alimento</p>
|
|
558
|
+
</div>
|
|
559
|
+
|
|
560
|
+
</li>
|
|
561
|
+
|
|
562
|
+
<li>
|
|
563
|
+
|
|
564
|
+
<span class='name'>lipidos</span>
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
<span class='type'>(<tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>)</span>
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
—
|
|
572
|
+
<div class='inline'>
|
|
573
|
+
<p>lipidos contenidos en el alimento</p>
|
|
574
|
+
</div>
|
|
575
|
+
|
|
576
|
+
</li>
|
|
577
|
+
|
|
578
|
+
</ul>
|
|
579
|
+
|
|
580
|
+
<p class="tag_title">Since:</p>
|
|
581
|
+
<ul class="since">
|
|
582
|
+
|
|
583
|
+
<li>
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
<div class='inline'>
|
|
590
|
+
<p>1.0.0</p>
|
|
591
|
+
</div>
|
|
592
|
+
|
|
593
|
+
</li>
|
|
594
|
+
|
|
595
|
+
</ul>
|
|
596
|
+
|
|
597
|
+
</div><table class="source_code">
|
|
598
|
+
<tr>
|
|
599
|
+
<td>
|
|
600
|
+
<pre class="lines">
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
20
|
|
604
|
+
21
|
|
605
|
+
22
|
|
606
|
+
23
|
|
607
|
+
24
|
|
608
|
+
25</pre>
|
|
609
|
+
</td>
|
|
610
|
+
<td>
|
|
611
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 20</span>
|
|
612
|
+
|
|
613
|
+
<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_glucidos'>glucidos</span><span class='comma'>,</span> <span class='id identifier rubyid_proteinas'>proteinas</span><span class='comma'>,</span> <span class='id identifier rubyid_lipidos'>lipidos</span><span class='rparen'>)</span>
|
|
614
|
+
<span class='ivar'>@nombre</span> <span class='op'>=</span> <span class='id identifier rubyid_nombre'>nombre</span>
|
|
615
|
+
<span class='ivar'>@glucidos</span> <span class='op'>=</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
|
|
616
|
+
<span class='ivar'>@proteinas</span> <span class='op'>=</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
|
|
617
|
+
<span class='ivar'>@lipidos</span> <span class='op'>=</span> <span class='id identifier rubyid_lipidos'>lipidos</span>
|
|
618
|
+
<span class='kw'>end</span></pre>
|
|
619
|
+
</td>
|
|
620
|
+
</tr>
|
|
621
|
+
</table>
|
|
622
|
+
</div>
|
|
623
|
+
|
|
624
|
+
</div>
|
|
625
|
+
|
|
626
|
+
<div id="instance_attr_details" class="attr_details">
|
|
627
|
+
<h2>Instance Attribute Details</h2>
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
<span id=""></span>
|
|
631
|
+
<div class="method_details first">
|
|
632
|
+
<h3 class="signature first" id="glucidos-instance_method">
|
|
633
|
+
|
|
634
|
+
#<strong>glucidos</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
</h3><div class="docstring">
|
|
641
|
+
<div class="discussion">
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
</div>
|
|
645
|
+
</div>
|
|
646
|
+
<div class="tags">
|
|
647
|
+
|
|
648
|
+
<p class="tag_title">Since:</p>
|
|
649
|
+
<ul class="since">
|
|
650
|
+
|
|
651
|
+
<li>
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
<div class='inline'>
|
|
658
|
+
<p>1.0.0</p>
|
|
659
|
+
</div>
|
|
660
|
+
|
|
661
|
+
</li>
|
|
662
|
+
|
|
663
|
+
</ul>
|
|
664
|
+
|
|
665
|
+
</div><table class="source_code">
|
|
666
|
+
<tr>
|
|
667
|
+
<td>
|
|
668
|
+
<pre class="lines">
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
11
|
|
672
|
+
12
|
|
673
|
+
13</pre>
|
|
674
|
+
</td>
|
|
675
|
+
<td>
|
|
676
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 11</span>
|
|
677
|
+
|
|
678
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
|
|
679
|
+
<span class='ivar'>@glucidos</span>
|
|
680
|
+
<span class='kw'>end</span></pre>
|
|
681
|
+
</td>
|
|
682
|
+
</tr>
|
|
683
|
+
</table>
|
|
684
|
+
</div>
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
<span id=""></span>
|
|
688
|
+
<div class="method_details ">
|
|
689
|
+
<h3 class="signature " id="lipidos-instance_method">
|
|
690
|
+
|
|
691
|
+
#<strong>lipidos</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
</h3><div class="docstring">
|
|
698
|
+
<div class="discussion">
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
<div class="tags">
|
|
704
|
+
|
|
705
|
+
<p class="tag_title">Since:</p>
|
|
706
|
+
<ul class="since">
|
|
707
|
+
|
|
708
|
+
<li>
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
<div class='inline'>
|
|
715
|
+
<p>1.0.0</p>
|
|
716
|
+
</div>
|
|
717
|
+
|
|
718
|
+
</li>
|
|
719
|
+
|
|
720
|
+
</ul>
|
|
721
|
+
|
|
722
|
+
</div><table class="source_code">
|
|
723
|
+
<tr>
|
|
724
|
+
<td>
|
|
725
|
+
<pre class="lines">
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
11
|
|
729
|
+
12
|
|
730
|
+
13</pre>
|
|
731
|
+
</td>
|
|
732
|
+
<td>
|
|
733
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 11</span>
|
|
734
|
+
|
|
735
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_lipidos'>lipidos</span>
|
|
736
|
+
<span class='ivar'>@lipidos</span>
|
|
737
|
+
<span class='kw'>end</span></pre>
|
|
738
|
+
</td>
|
|
739
|
+
</tr>
|
|
740
|
+
</table>
|
|
741
|
+
</div>
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
<span id=""></span>
|
|
745
|
+
<div class="method_details ">
|
|
746
|
+
<h3 class="signature " id="nombre-instance_method">
|
|
747
|
+
|
|
748
|
+
#<strong>nombre</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
</h3><div class="docstring">
|
|
755
|
+
<div class="discussion">
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
</div>
|
|
759
|
+
</div>
|
|
760
|
+
<div class="tags">
|
|
761
|
+
|
|
762
|
+
<p class="tag_title">Since:</p>
|
|
763
|
+
<ul class="since">
|
|
764
|
+
|
|
765
|
+
<li>
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
<div class='inline'>
|
|
772
|
+
<p>1.0.0</p>
|
|
773
|
+
</div>
|
|
774
|
+
|
|
775
|
+
</li>
|
|
776
|
+
|
|
777
|
+
</ul>
|
|
778
|
+
|
|
779
|
+
</div><table class="source_code">
|
|
780
|
+
<tr>
|
|
781
|
+
<td>
|
|
782
|
+
<pre class="lines">
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
11
|
|
786
|
+
12
|
|
787
|
+
13</pre>
|
|
788
|
+
</td>
|
|
789
|
+
<td>
|
|
790
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 11</span>
|
|
791
|
+
|
|
792
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_nombre'>nombre</span>
|
|
793
|
+
<span class='ivar'>@nombre</span>
|
|
794
|
+
<span class='kw'>end</span></pre>
|
|
795
|
+
</td>
|
|
796
|
+
</tr>
|
|
797
|
+
</table>
|
|
798
|
+
</div>
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
<span id=""></span>
|
|
802
|
+
<div class="method_details ">
|
|
803
|
+
<h3 class="signature " id="Number-instance_method">
|
|
804
|
+
|
|
805
|
+
#<strong>Number</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
</h3><div class="docstring">
|
|
812
|
+
<div class="discussion">
|
|
813
|
+
|
|
814
|
+
<p>glucidos glucidos contenidos en el alimento</p>
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
</div>
|
|
818
|
+
</div>
|
|
819
|
+
<div class="tags">
|
|
820
|
+
|
|
821
|
+
<p class="tag_title">Returns:</p>
|
|
822
|
+
<ul class="return">
|
|
823
|
+
|
|
824
|
+
<li>
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
—
|
|
832
|
+
<div class='inline'>
|
|
833
|
+
<p>the current value of Number</p>
|
|
834
|
+
</div>
|
|
835
|
+
|
|
836
|
+
</li>
|
|
837
|
+
|
|
838
|
+
</ul>
|
|
839
|
+
|
|
840
|
+
</div><table class="source_code">
|
|
841
|
+
<tr>
|
|
842
|
+
<td>
|
|
843
|
+
<pre class="lines">
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
9
|
|
847
|
+
10
|
|
848
|
+
11</pre>
|
|
849
|
+
</td>
|
|
850
|
+
<td>
|
|
851
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 9</span>
|
|
852
|
+
|
|
853
|
+
<span class='kw'>def</span> <span class='const'>Number</span>
|
|
854
|
+
<span class='ivar'>@Number</span>
|
|
855
|
+
<span class='kw'>end</span></pre>
|
|
856
|
+
</td>
|
|
857
|
+
</tr>
|
|
858
|
+
</table>
|
|
859
|
+
</div>
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
<span id=""></span>
|
|
863
|
+
<div class="method_details ">
|
|
864
|
+
<h3 class="signature " id="proteinas-instance_method">
|
|
865
|
+
|
|
866
|
+
#<strong>proteinas</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
</h3><div class="docstring">
|
|
873
|
+
<div class="discussion">
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
</div>
|
|
877
|
+
</div>
|
|
878
|
+
<div class="tags">
|
|
879
|
+
|
|
880
|
+
<p class="tag_title">Since:</p>
|
|
881
|
+
<ul class="since">
|
|
882
|
+
|
|
883
|
+
<li>
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
<div class='inline'>
|
|
890
|
+
<p>1.0.0</p>
|
|
891
|
+
</div>
|
|
892
|
+
|
|
893
|
+
</li>
|
|
894
|
+
|
|
895
|
+
</ul>
|
|
896
|
+
|
|
897
|
+
</div><table class="source_code">
|
|
898
|
+
<tr>
|
|
899
|
+
<td>
|
|
900
|
+
<pre class="lines">
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
11
|
|
904
|
+
12
|
|
905
|
+
13</pre>
|
|
906
|
+
</td>
|
|
907
|
+
<td>
|
|
908
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 11</span>
|
|
909
|
+
|
|
910
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
|
|
911
|
+
<span class='ivar'>@proteinas</span>
|
|
912
|
+
<span class='kw'>end</span></pre>
|
|
913
|
+
</td>
|
|
914
|
+
</tr>
|
|
915
|
+
</table>
|
|
916
|
+
</div>
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
<span id=""></span>
|
|
920
|
+
<div class="method_details ">
|
|
921
|
+
<h3 class="signature " id="String-instance_method">
|
|
922
|
+
|
|
923
|
+
#<strong>String</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
</h3><div class="docstring">
|
|
930
|
+
<div class="discussion">
|
|
931
|
+
|
|
932
|
+
<p>nombre Nombre del alimento</p>
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
</div>
|
|
936
|
+
</div>
|
|
937
|
+
<div class="tags">
|
|
938
|
+
|
|
939
|
+
<p class="tag_title">Returns:</p>
|
|
940
|
+
<ul class="return">
|
|
941
|
+
|
|
942
|
+
<li>
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
—
|
|
950
|
+
<div class='inline'>
|
|
951
|
+
<p>the current value of String</p>
|
|
952
|
+
</div>
|
|
953
|
+
|
|
954
|
+
</li>
|
|
955
|
+
|
|
956
|
+
</ul>
|
|
957
|
+
|
|
958
|
+
</div><table class="source_code">
|
|
959
|
+
<tr>
|
|
960
|
+
<td>
|
|
961
|
+
<pre class="lines">
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
9
|
|
965
|
+
10
|
|
966
|
+
11</pre>
|
|
967
|
+
</td>
|
|
968
|
+
<td>
|
|
969
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 9</span>
|
|
970
|
+
|
|
971
|
+
<span class='kw'>def</span> <span class='const'>String</span>
|
|
972
|
+
<span class='ivar'>@String</span>
|
|
973
|
+
<span class='kw'>end</span></pre>
|
|
974
|
+
</td>
|
|
975
|
+
</tr>
|
|
976
|
+
</table>
|
|
977
|
+
</div>
|
|
978
|
+
|
|
979
|
+
</div>
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
<div id="instance_method_details" class="method_details_list">
|
|
983
|
+
<h2>Instance Method Details</h2>
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
<div class="method_details first">
|
|
987
|
+
<h3 class="signature first" id="<=>-instance_method">
|
|
988
|
+
|
|
989
|
+
#<strong><=></strong>(other) ⇒ <tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
</h3><div class="docstring">
|
|
996
|
+
<div class="discussion">
|
|
997
|
+
|
|
998
|
+
<p>Constructor de Alimento</p>
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
</div>
|
|
1002
|
+
</div>
|
|
1003
|
+
<div class="tags">
|
|
1004
|
+
<p class="tag_title">Parameters:</p>
|
|
1005
|
+
<ul class="param">
|
|
1006
|
+
|
|
1007
|
+
<li>
|
|
1008
|
+
|
|
1009
|
+
<span class='name'>other</span>
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></tt>)</span>
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
—
|
|
1017
|
+
<div class='inline'>
|
|
1018
|
+
<p>otro objeto de clase Alimento</p>
|
|
1019
|
+
</div>
|
|
1020
|
+
|
|
1021
|
+
</li>
|
|
1022
|
+
|
|
1023
|
+
</ul>
|
|
1024
|
+
|
|
1025
|
+
<p class="tag_title">Returns:</p>
|
|
1026
|
+
<ul class="return">
|
|
1027
|
+
|
|
1028
|
+
<li>
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
<span class='type'>(<tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>)</span>
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
—
|
|
1036
|
+
<div class='inline'>
|
|
1037
|
+
<p>Devuelve la relación de comparación entre el objeto que invoca el método y
|
|
1038
|
+
el otro objeto Alimento</p>
|
|
1039
|
+
</div>
|
|
1040
|
+
|
|
1041
|
+
</li>
|
|
1042
|
+
|
|
1043
|
+
</ul>
|
|
1044
|
+
<p class="tag_title">Since:</p>
|
|
1045
|
+
<ul class="since">
|
|
1046
|
+
|
|
1047
|
+
<li>
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
<div class='inline'>
|
|
1054
|
+
<p>1.0.0</p>
|
|
1055
|
+
</div>
|
|
1056
|
+
|
|
1057
|
+
</li>
|
|
1058
|
+
|
|
1059
|
+
</ul>
|
|
1060
|
+
|
|
1061
|
+
</div><table class="source_code">
|
|
1062
|
+
<tr>
|
|
1063
|
+
<td>
|
|
1064
|
+
<pre class="lines">
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
62
|
|
1068
|
+
63
|
|
1069
|
+
64</pre>
|
|
1070
|
+
</td>
|
|
1071
|
+
<td>
|
|
1072
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 62</span>
|
|
1073
|
+
|
|
1074
|
+
<span class='kw'>def</span> <span class='op'><=></span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
1075
|
+
<span class='id identifier rubyid_kcal'>kcal</span> <span class='op'><=></span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_kcal'>kcal</span>
|
|
1076
|
+
<span class='kw'>end</span></pre>
|
|
1077
|
+
</td>
|
|
1078
|
+
</tr>
|
|
1079
|
+
</table>
|
|
1080
|
+
</div>
|
|
1081
|
+
|
|
1082
|
+
<div class="method_details ">
|
|
1083
|
+
<h3 class="signature " id="calculate_index-instance_method">
|
|
1084
|
+
|
|
1085
|
+
#<strong>calculate_index</strong>(alimento, glucosa) ⇒ <tt>Float</tt>
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
</h3><div class="docstring">
|
|
1092
|
+
<div class="discussion">
|
|
1093
|
+
|
|
1094
|
+
<p>Método para calcular el índice glucémico</p>
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
</div>
|
|
1098
|
+
</div>
|
|
1099
|
+
<div class="tags">
|
|
1100
|
+
<p class="tag_title">Parameters:</p>
|
|
1101
|
+
<ul class="param">
|
|
1102
|
+
|
|
1103
|
+
<li>
|
|
1104
|
+
|
|
1105
|
+
<span class='name'>alimento</span>
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
<span class='type'>(<tt>Array<Float></tt>)</span>
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
—
|
|
1113
|
+
<div class='inline'>
|
|
1114
|
+
<p>vector con los datos de glucosa tras la ingesta del alimento por cada
|
|
1115
|
+
individuo en el experimento</p>
|
|
1116
|
+
</div>
|
|
1117
|
+
|
|
1118
|
+
</li>
|
|
1119
|
+
|
|
1120
|
+
<li>
|
|
1121
|
+
|
|
1122
|
+
<span class='name'>glucosa</span>
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
<span class='type'>(<tt>Array<Float></tt>)</span>
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
—
|
|
1130
|
+
<div class='inline'>
|
|
1131
|
+
<p>vector con los datos de glucosa tras la ingesta de 50gr de glucosa por cada
|
|
1132
|
+
individuo en el experimento</p>
|
|
1133
|
+
</div>
|
|
1134
|
+
|
|
1135
|
+
</li>
|
|
1136
|
+
|
|
1137
|
+
</ul>
|
|
1138
|
+
|
|
1139
|
+
<p class="tag_title">Returns:</p>
|
|
1140
|
+
<ul class="return">
|
|
1141
|
+
|
|
1142
|
+
<li>
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
<span class='type'>(<tt>Float</tt>)</span>
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
—
|
|
1150
|
+
<div class='inline'>
|
|
1151
|
+
<p>Devuelve el índice glucémico dado el experimento</p>
|
|
1152
|
+
</div>
|
|
1153
|
+
|
|
1154
|
+
</li>
|
|
1155
|
+
|
|
1156
|
+
</ul>
|
|
1157
|
+
<p class="tag_title">Since:</p>
|
|
1158
|
+
<ul class="since">
|
|
1159
|
+
|
|
1160
|
+
<li>
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
<div class='inline'>
|
|
1167
|
+
<p>1.0.0</p>
|
|
1168
|
+
</div>
|
|
1169
|
+
|
|
1170
|
+
</li>
|
|
1171
|
+
|
|
1172
|
+
</ul>
|
|
1173
|
+
|
|
1174
|
+
</div><table class="source_code">
|
|
1175
|
+
<tr>
|
|
1176
|
+
<td>
|
|
1177
|
+
<pre class="lines">
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
32
|
|
1181
|
+
33
|
|
1182
|
+
34
|
|
1183
|
+
35
|
|
1184
|
+
36
|
|
1185
|
+
37
|
|
1186
|
+
38
|
|
1187
|
+
39
|
|
1188
|
+
40
|
|
1189
|
+
41
|
|
1190
|
+
42
|
|
1191
|
+
43
|
|
1192
|
+
44</pre>
|
|
1193
|
+
</td>
|
|
1194
|
+
<td>
|
|
1195
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 32</span>
|
|
1196
|
+
|
|
1197
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_calculate_index'>calculate_index</span><span class='lparen'>(</span><span class='id identifier rubyid_alimento'>alimento</span><span class='comma'>,</span> <span class='id identifier rubyid_glucosa'>glucosa</span><span class='rparen'>)</span>
|
|
1198
|
+
<span class='id identifier rubyid_acum'>acum</span> <span class='op'>=</span> <span class='id identifier rubyid_alimento'>alimento</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='period'>.</span><span class='id identifier rubyid_with_index'>with_index</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='kw'>if</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span> <span class='op'>>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span> <span class='kw'>then</span> <span class='int'>0</span> <span class='kw'>else</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_a'>a</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_a'>a</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>/</span><span class='int'>2</span><span class='rparen'>)</span><span class='op'>*</span><span class='int'>5</span> <span class='kw'>end</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
1199
|
+
<span class='id identifier rubyid_aibc'>aibc</span> <span class='op'>=</span> <span class='id identifier rubyid_acum'>acum</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>+</span> <span class='id identifier rubyid_a'>a</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
1200
|
+
|
|
1201
|
+
<span class='id identifier rubyid_acum'>acum</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1202
|
+
|
|
1203
|
+
<span class='id identifier rubyid_acum'>acum</span> <span class='op'>=</span> <span class='id identifier rubyid_glucosa'>glucosa</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='period'>.</span><span class='id identifier rubyid_with_index'>with_index</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='kw'>if</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span> <span class='op'>>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span> <span class='kw'>then</span> <span class='int'>0</span> <span class='kw'>else</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_a'>a</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_a'>a</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>/</span><span class='int'>2</span><span class='rparen'>)</span><span class='op'>*</span><span class='int'>5</span> <span class='kw'>end</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
1204
|
+
<span class='id identifier rubyid_aibcgl'>aibcgl</span> <span class='op'>=</span> <span class='id identifier rubyid_acum'>acum</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>+</span> <span class='id identifier rubyid_a'>a</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
|
1205
|
+
|
|
1206
|
+
<span class='id identifier rubyid_igind'>igind</span> <span class='op'>=</span> <span class='id identifier rubyid_aibc'>aibc</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='period'>.</span><span class='id identifier rubyid_with_index'>with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_aibc'>aibc</span><span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span> <span class='op'>/</span> <span class='id identifier rubyid_aibcgl'>aibcgl</span><span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='int'>100</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1207
|
+
|
|
1208
|
+
<span class='id identifier rubyid_igind'>igind</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='symbol'>:+</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='id identifier rubyid_igind'>igind</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
|
1209
|
+
<span class='kw'>end</span></pre>
|
|
1210
|
+
</td>
|
|
1211
|
+
</tr>
|
|
1212
|
+
</table>
|
|
1213
|
+
</div>
|
|
1214
|
+
|
|
1215
|
+
<div class="method_details ">
|
|
1216
|
+
<h3 class="signature " id="kcal-instance_method">
|
|
1217
|
+
|
|
1218
|
+
#<strong>kcal</strong> ⇒ <tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
</h3><div class="docstring">
|
|
1225
|
+
<div class="discussion">
|
|
1226
|
+
|
|
1227
|
+
<p>Constructor de Alimento</p>
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
</div>
|
|
1231
|
+
</div>
|
|
1232
|
+
<div class="tags">
|
|
1233
|
+
|
|
1234
|
+
<p class="tag_title">Returns:</p>
|
|
1235
|
+
<ul class="return">
|
|
1236
|
+
|
|
1237
|
+
<li>
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
<span class='type'>(<tt><span class='object_link'><a href="#Number-instance_method" title="Alimento#Number (method)">Number</a></span></tt>)</span>
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
—
|
|
1245
|
+
<div class='inline'>
|
|
1246
|
+
<p>Devuelve el valor calórico del alimento representado</p>
|
|
1247
|
+
</div>
|
|
1248
|
+
|
|
1249
|
+
</li>
|
|
1250
|
+
|
|
1251
|
+
</ul>
|
|
1252
|
+
<p class="tag_title">Since:</p>
|
|
1253
|
+
<ul class="since">
|
|
1254
|
+
|
|
1255
|
+
<li>
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
<div class='inline'>
|
|
1262
|
+
<p>1.0.0</p>
|
|
1263
|
+
</div>
|
|
1264
|
+
|
|
1265
|
+
</li>
|
|
1266
|
+
|
|
1267
|
+
</ul>
|
|
1268
|
+
|
|
1269
|
+
</div><table class="source_code">
|
|
1270
|
+
<tr>
|
|
1271
|
+
<td>
|
|
1272
|
+
<pre class="lines">
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
55
|
|
1276
|
+
56
|
|
1277
|
+
57</pre>
|
|
1278
|
+
</td>
|
|
1279
|
+
<td>
|
|
1280
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 55</span>
|
|
1281
|
+
|
|
1282
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_kcal'>kcal</span>
|
|
1283
|
+
<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'>@lipidos</span> <span class='op'>*</span> <span class='int'>9</span>
|
|
1284
|
+
<span class='kw'>end</span></pre>
|
|
1285
|
+
</td>
|
|
1286
|
+
</tr>
|
|
1287
|
+
</table>
|
|
1288
|
+
</div>
|
|
1289
|
+
|
|
1290
|
+
<div class="method_details ">
|
|
1291
|
+
<h3 class="signature " id="to_s-instance_method">
|
|
1292
|
+
|
|
1293
|
+
#<strong>to_s</strong> ⇒ <tt><span class='object_link'><a href="#String-instance_method" title="Alimento#String (method)">String</a></span></tt>
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
</h3><div class="docstring">
|
|
1300
|
+
<div class="discussion">
|
|
1301
|
+
|
|
1302
|
+
<p>Convierte el objeto en un String</p>
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
</div>
|
|
1306
|
+
</div>
|
|
1307
|
+
<div class="tags">
|
|
1308
|
+
|
|
1309
|
+
<p class="tag_title">Returns:</p>
|
|
1310
|
+
<ul class="return">
|
|
1311
|
+
|
|
1312
|
+
<li>
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
<span class='type'>(<tt><span class='object_link'><a href="#String-instance_method" title="Alimento#String (method)">String</a></span></tt>)</span>
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
—
|
|
1320
|
+
<div class='inline'>
|
|
1321
|
+
<p>descripción del alimento en una cadena de caracteres</p>
|
|
1322
|
+
</div>
|
|
1323
|
+
|
|
1324
|
+
</li>
|
|
1325
|
+
|
|
1326
|
+
</ul>
|
|
1327
|
+
<p class="tag_title">Since:</p>
|
|
1328
|
+
<ul class="since">
|
|
1329
|
+
|
|
1330
|
+
<li>
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
<div class='inline'>
|
|
1337
|
+
<p>1.0.0</p>
|
|
1338
|
+
</div>
|
|
1339
|
+
|
|
1340
|
+
</li>
|
|
1341
|
+
|
|
1342
|
+
</ul>
|
|
1343
|
+
|
|
1344
|
+
</div><table class="source_code">
|
|
1345
|
+
<tr>
|
|
1346
|
+
<td>
|
|
1347
|
+
<pre class="lines">
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
48
|
|
1351
|
+
49
|
|
1352
|
+
50
|
|
1353
|
+
51</pre>
|
|
1354
|
+
</td>
|
|
1355
|
+
<td>
|
|
1356
|
+
<pre class="code"><span class="info file"># File 'lib/alimento/Alimento.rb', line 48</span>
|
|
1357
|
+
|
|
1358
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
|
1359
|
+
<span class='id identifier rubyid_x'>x</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nombre'>nombre</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_proteinas'>proteinas</span><span class='embexpr_end'>}</span><span class='tstring_content'>g proteínas, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_glucidos'>glucidos</span><span class='embexpr_end'>}</span><span class='tstring_content'>g glúcidos, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_lipidos'>lipidos</span><span class='embexpr_end'>}</span><span class='tstring_content'>g lípidos</span><span class='tstring_end'>"</span></span>
|
|
1360
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_x'>x</span>
|
|
1361
|
+
<span class='kw'>end</span></pre>
|
|
1362
|
+
</td>
|
|
1363
|
+
</tr>
|
|
1364
|
+
</table>
|
|
1365
|
+
</div>
|
|
1366
|
+
|
|
1367
|
+
</div>
|
|
1368
|
+
|
|
1369
|
+
</div>
|
|
1370
|
+
|
|
1371
|
+
<div id="footer">
|
|
1372
|
+
Generated on Fri Nov 24 11:12:15 2017 by
|
|
1373
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1374
|
+
0.9.9 (ruby-2.3.4).
|
|
1375
|
+
</div>
|
|
1376
|
+
|
|
1377
|
+
</div>
|
|
1378
|
+
</body>
|
|
1379
|
+
</html>
|