Alimento 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +6 -0
- data/.gitignore +12 -0
- data/.rake_tasks~ +8 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Alimento.gemspec +39 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/README.md +35 -0
- data/Rakefile +78 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimentos.html +1854 -0
- data/docs/ListaDoble.html +1236 -0
- data/docs/Nodo.html +398 -0
- data/docs/_index.html +133 -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 +117 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +117 -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 +299 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/Alimento/alimentos.rb +193 -0
- data/lib/Alimento/glucemico.rb +333 -0
- data/lib/Alimento/lista_doble.rb +155 -0
- data/lib/Alimento/ordenacion.rb +321 -0
- data/lib/Alimento/tipo_alimento.rb +29 -0
- data/lib/Alimento/version.rb +3 -0
- data/lib/Alimento.rb +13 -0
- metadata +177 -0
@@ -0,0 +1,110 @@
|
|
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
|
+
Top Level Namespace
|
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 = "";
|
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> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Top Level Namespace</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>Top Level Namespace
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<h2>Defined Under Namespace</h2>
|
82
|
+
<p class="children">
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Alimentos.html" title="Alimentos (class)">Alimentos</a></span>, <span class='object_link'><a href="ListaDoble.html" title="ListaDoble (class)">ListaDoble</a></span>, <span class='object_link'><a href="Nodo.html" title="Nodo (class)">Nodo</a></span>
|
88
|
+
|
89
|
+
|
90
|
+
</p>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="footer">
|
103
|
+
Generated on Wed Nov 15 11:51:03 2017 by
|
104
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
+
0.9.9 (ruby-2.3.3).
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</body>
|
110
|
+
</html>
|
@@ -0,0 +1,193 @@
|
|
1
|
+
#! /usr/local/rvm/rubies/ruby-2.1.1/bin/ruby
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
# @author Miguel Parra Esquivel (miguelpe83)
|
6
|
+
# @abstract
|
7
|
+
# @since 0.6.0
|
8
|
+
|
9
|
+
class Alimentos
|
10
|
+
include Comparable
|
11
|
+
|
12
|
+
# @return [String] objeto convertidos con el formato string de la descripcion de la clase
|
13
|
+
def self.description
|
14
|
+
"clase que muestra informacion de nutrientes de un Alimento"
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
# @attr_reader [Symbol] describe los getter de la clase
|
19
|
+
# @attr_writer [Symbol] describe los setter de la clase
|
20
|
+
# @param nombre_ali [String] nombre del alimentos
|
21
|
+
# @param proteinas [String] proteinas
|
22
|
+
# @param glucidos [String] glucidos
|
23
|
+
# @param lipidos [String] lipidos
|
24
|
+
# @return [String] objeto convertidos con el formato string
|
25
|
+
|
26
|
+
#attr_accessor :nombre_ali , :proteinas , :glucidos , :lipidos
|
27
|
+
attr_writer :nombre_ali , :proteinas , :glucidos , :lipidos
|
28
|
+
attr_reader :nombre_ali , :proteinas , :glucidos , :lipidos
|
29
|
+
|
30
|
+
def initialize (nombre_ali,proteinas,glucidos,lipidos)
|
31
|
+
@nombre_ali = nombre_ali
|
32
|
+
@proteinas = proteinas
|
33
|
+
@glucidos = glucidos
|
34
|
+
@lipidos = lipidos
|
35
|
+
end
|
36
|
+
|
37
|
+
##### getter #######
|
38
|
+
|
39
|
+
# @param valor [String] nombre del alimentos
|
40
|
+
def get_nombre_ali (valor)
|
41
|
+
@nombre_ali = valor
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param valor [String] proteinas
|
45
|
+
def get_proteinas (valor)
|
46
|
+
@proteinas = valor
|
47
|
+
end
|
48
|
+
|
49
|
+
# @param valor [String] glucidos
|
50
|
+
def get_glucidos (valor)
|
51
|
+
@glucidos = valor
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param valor [String] lipidos
|
55
|
+
def get_lipidos (valor)
|
56
|
+
@glucidos = valor
|
57
|
+
end
|
58
|
+
|
59
|
+
###### metodo to_s ################
|
60
|
+
# @return [String] objeto convertidos con el formato string de nombre_ali
|
61
|
+
def nombre_ali_to_s
|
62
|
+
imprime = "#{@nombre_ali}" #número de porciones
|
63
|
+
return imprime
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [String] objeto convertidos con el formato string proteinas
|
67
|
+
def proteinas_to_s
|
68
|
+
imprime = " #{@proteinas}" #número de porciones
|
69
|
+
return imprime
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [String] objeto convertidos con el formato string glucidos
|
73
|
+
def glucidos_to_s
|
74
|
+
imprime = " #{@glucidos}" #número de porciones
|
75
|
+
return imprime
|
76
|
+
end
|
77
|
+
|
78
|
+
# @return [String] objeto convertidos con el formato string lipidos
|
79
|
+
def lipidos_to_s
|
80
|
+
imprime = " #{@lipidos}" #número de porciones
|
81
|
+
return imprime
|
82
|
+
end
|
83
|
+
|
84
|
+
# @return [String] objeto convertidos con el formato string
|
85
|
+
def to_s
|
86
|
+
nombre_ali_to_s + proteinas_to_s + glucidos_to_s + lipidos_to_s
|
87
|
+
end
|
88
|
+
|
89
|
+
### calculo de calorias ###########
|
90
|
+
# @return [String] objeto convertidos con el formato string de calculo_calorias
|
91
|
+
def calculo_calorias
|
92
|
+
result = 0
|
93
|
+
result = (@proteinas*4.0) + (@glucidos*4.0) + (@lipidos*9.0)
|
94
|
+
end
|
95
|
+
|
96
|
+
# @param other [String] hacerlo comparable el objeto con otro objeto del mismo tipo
|
97
|
+
# @return [String] objeto convertidos con el formato string
|
98
|
+
def <=> (other)
|
99
|
+
return nil unless other.instance_of? Alimentos
|
100
|
+
@nombre_ali <=> other.nombre_ali
|
101
|
+
@proteinas <=> other.proteinas
|
102
|
+
@glucidos <=> other.glucidos
|
103
|
+
@lipidos <=> other.lipidos
|
104
|
+
end
|
105
|
+
|
106
|
+
# def <=>(other)
|
107
|
+
# # los comentarios locales a los métodos no generan documentación
|
108
|
+
# return nil unless other.instance_of? Point
|
109
|
+
# @x**2 + @y**2 <=> other.x**2 + other.y**2
|
110
|
+
# end
|
111
|
+
|
112
|
+
#Tipeado pato
|
113
|
+
# def ==(other)
|
114
|
+
# if ((other.respond_to?tipo_ali) && (other.respond_to?proteinas)&& (other.respond_to?lipidos)&& (other.respond_to?glucidos)) then
|
115
|
+
# @tipo_ali == other.tipo_ali && @proteinas == other.proteinas && @lipidos == other.lipidos && @glucidos == other.glucidos
|
116
|
+
# end
|
117
|
+
# rescue
|
118
|
+
# false
|
119
|
+
# end
|
120
|
+
|
121
|
+
#Mas restrictivo (sin herencia - usa instance_of?)
|
122
|
+
# def ==(other)
|
123
|
+
# if other.instance_of?Alimentos
|
124
|
+
# @tipo_ali == other.tipo_ali && @proteinas == other.proteinas && @lipidos == other.lipidos && @glucidos == other.glucidos
|
125
|
+
# else
|
126
|
+
# false
|
127
|
+
# end
|
128
|
+
# end
|
129
|
+
|
130
|
+
def ==(other)
|
131
|
+
# los comentarios locales a los métodos no generan documentación
|
132
|
+
if other.is_a?Alimentos
|
133
|
+
@tipo_ali == other.tipo_ali && @proteinas == other.proteinas && @lipidos == other.lipidos && @glucidos == other.glucidos
|
134
|
+
else
|
135
|
+
false
|
136
|
+
end
|
137
|
+
end
|
138
|
+
############################################# OTRO CODIGO ###################################################3
|
139
|
+
# Tipeado pato
|
140
|
+
# def ==(other)
|
141
|
+
# if ((other.respond_to?x) && (other.respond_to?y)) then
|
142
|
+
# @x == other.x && @y == other.y
|
143
|
+
# end
|
144
|
+
# rescue
|
145
|
+
# false
|
146
|
+
# end
|
147
|
+
|
148
|
+
# Mas restrictivo (sin herencia - usa instance_of?)
|
149
|
+
# def ==(other)
|
150
|
+
# if other.instance_of?Point
|
151
|
+
# @x == other.x && @y == other.y
|
152
|
+
# else
|
153
|
+
# false
|
154
|
+
# end
|
155
|
+
# end
|
156
|
+
|
157
|
+
# Restrictivo (con herencia - usa is_a?)
|
158
|
+
# Se invalida porque el que proporciona el mix-in
|
159
|
+
# no distingue entre (1,0) y el (0,1)
|
160
|
+
# def ==(other)
|
161
|
+
# # los comentarios locales a los métodos no generan documentación
|
162
|
+
# if other.is_a?Point
|
163
|
+
# @x == other.x && @y == other.y
|
164
|
+
# else
|
165
|
+
# false
|
166
|
+
# end
|
167
|
+
# end
|
168
|
+
##mujer
|
169
|
+
# def <=>(other)
|
170
|
+
# if ((@autor <=> other.autor)==0)
|
171
|
+
# if((@titulo <=> other.titulo)==0)
|
172
|
+
# @fecha_publicacion <=> other.fecha_publicacion
|
173
|
+
# else
|
174
|
+
# @titulo <=> other.titulo
|
175
|
+
# end
|
176
|
+
# else
|
177
|
+
# @autor <=> other.autor
|
178
|
+
# end
|
179
|
+
# end
|
180
|
+
##josu
|
181
|
+
# def <=>(other)
|
182
|
+
# if((@autor <=> other.autor)==0)
|
183
|
+
# if ((@fecha_publicacion <=> other.fecha_publicacion)==0)
|
184
|
+
# @titulo <=> other.titulo
|
185
|
+
# else
|
186
|
+
# @fecha_publicacion <=> other.fecha_publicacion
|
187
|
+
# end
|
188
|
+
# else
|
189
|
+
# @autor <=> other.autor
|
190
|
+
# end
|
191
|
+
# end
|
192
|
+
|
193
|
+
end
|
@@ -0,0 +1,333 @@
|
|
1
|
+
#! /usr/local/rvm/rubies/ruby-2.1.1/bin/ruby
|
2
|
+
|
3
|
+
class Glucemico
|
4
|
+
#include Comparable
|
5
|
+
TIEMPO_MUESTRA = 24
|
6
|
+
NUM_ALIMENTOS = 4
|
7
|
+
attr_accessor :tiempo
|
8
|
+
attr_accessor :individuo1,:ind1_compota_manzana,:ind1_yogurt,:ind1_chocolate,:ind1_glucosa
|
9
|
+
attr_accessor :individuo2,:ind2_compota_manzana,:ind2_yogurt,:ind2_chocolate,:ind2_glucosa
|
10
|
+
|
11
|
+
attr_accessor :datos_ind1,:datos_ind2,:g
|
12
|
+
|
13
|
+
def self.description
|
14
|
+
"clase que calcula el indice glucemico de individuos"
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@alimentos_texto = ['glucosa','compota_manzana','yogurt','chocolate']
|
19
|
+
@tiempo = [0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120]
|
20
|
+
|
21
|
+
@individuo1 = 'ind1'
|
22
|
+
@ind1_compota_manzana = [6.7,6.5,6.8,6.9,7.0,7.1,6.9,6.9,6.9,6.7,6.9,7.3,7.0,7.0,7.2,7.1,6.8,7.2,7.3,7.0,6.8,6.7,6.8,6.7,6.9]
|
23
|
+
@ind1_yogurt = [6.1,6.6,6.3,6.3,6.1,6.9,6.8,6.5,6.4,6.9,6.8,6.5,6.3,6.2,6.7,6.2,5.9,5.8,5.8,5.8,5.8,5.8,5.9,6.2,6.4]
|
24
|
+
@ind1_chocolate = [6.5,6.5,6.7,6.5,6.5,6.8,6.7,6.2,6.5,7.2,6.9,7.0,6.3,6.2,6.1,5.9,5.8,6.1,6.7,6.7,6.6,6.7,6.9,7.2,7.1]
|
25
|
+
@ind1_glucosa = [4.9,5.3,5.9,6.7,7.2,7.6,8.0,8.2,8.2,8.4,8.3,8.3,8.0,7.5,7.1,6.8,6.8,6.9,6.8,6.3,6.2,6.3,6.2,6.3,6.1]
|
26
|
+
@datos_ind1 = [@ind1_glucosa,@ind1_compota_manzana,@ind1_yogurt,@ind1_chocolate,@ind1_glucosa]
|
27
|
+
|
28
|
+
@individuo2 = 'ind2'
|
29
|
+
@ind2_compota_manzana = [4.6,4.8,5.3,5.6,6.1,6.5,6.6,7.0,7.0,6.8,6.4,6.3,6.1,6.1,6.2,6.0,6.1,6.1,6.2,6.3,6.4,6.1,6.1,5.7,5.9]
|
30
|
+
@ind2_yogurt = [4.9,4.9,5.2,5.8,6.5,7.0,7.2,7.3,7.3,6.6,6.2,6.1,6.0,6.1,5.9,5.9,5.9,5.9,5.8,5.8,5.5,5.5,5.6,5.9,5.9]
|
31
|
+
@ind2_chocolate = [4.6,4.6,4.7,4.7,4.8,4.7,4.8,4.8,4.6,4.4,4.7,4.7,4.8,4.7,5.2,5.9,5.9,5.7,5.4,5.3,5.1,4.8,4.8,4.9,5.9]
|
32
|
+
@ind2_glucosa = [6.3,5.4,5.6,5.7,6.5,7.4,7.9,7.4,7.7,7.9,7.9,7.8,7.8,7.8,8.0,8.5,9.4,10.8,10.5,9.1,8.9,8.3,7.7,7.6,7.5]
|
33
|
+
@datos_ind2 = [@ind2_glucosa,@ind2_compota_manzana,@ind2_yogurt,@ind2_chocolate]
|
34
|
+
|
35
|
+
@datos = [@datos_ind1,@datos_ind2]
|
36
|
+
|
37
|
+
@g = [[1,2,3],[4,5,6]]
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# def aibc
|
42
|
+
# i = 0
|
43
|
+
# r = []
|
44
|
+
# while i < @g.size
|
45
|
+
# index = 1
|
46
|
+
# s = []
|
47
|
+
# while (index < @g[i].size)
|
48
|
+
# if (@g[i][index] < @g[i][0])
|
49
|
+
# s << 0.0
|
50
|
+
# else
|
51
|
+
# s << (((@g[i][index] - @g[i][0]) + (@g[i][index-1] - @g[i][0]))/2)*5
|
52
|
+
# end
|
53
|
+
# index = index + 1
|
54
|
+
# end
|
55
|
+
# r << s
|
56
|
+
# i = i + 1
|
57
|
+
# end
|
58
|
+
|
59
|
+
#se aplica solo a un individuo
|
60
|
+
def formula_AIBC (alimentos_usuario)
|
61
|
+
i = 0
|
62
|
+
r = []
|
63
|
+
#each_byte
|
64
|
+
|
65
|
+
alimentos_usuario.each_with_index do |valor,i|
|
66
|
+
#puts "#{valor} at #{i}"
|
67
|
+
|
68
|
+
#i.to_f
|
69
|
+
index=1
|
70
|
+
s=[]
|
71
|
+
valor.each_with_index do |valor2,index|
|
72
|
+
#puts "#{valor2} at #{index}"
|
73
|
+
if (alimentos_usuario[i][index] < alimentos_usuario[i][0])
|
74
|
+
|
75
|
+
s << (0.0)
|
76
|
+
else
|
77
|
+
#s << (((alimento[i][index].to_f - alimento[i][0].to_f) + (alimento[i][index-1].to_f - alimento[i][0].to_f))/2)*5
|
78
|
+
a = (alimentos_usuario[i][index].to_f - alimentos_usuario[i][0].to_f)
|
79
|
+
b = (alimentos_usuario[i][index-1] - alimentos_usuario[i][0])
|
80
|
+
s << (((((a)+(b))/2.0)*5.0))
|
81
|
+
|
82
|
+
end
|
83
|
+
#index += 1
|
84
|
+
|
85
|
+
|
86
|
+
end
|
87
|
+
#p (s)
|
88
|
+
r << s
|
89
|
+
#i += 1
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# suma = []
|
94
|
+
# j = 0
|
95
|
+
# while j < @g.size
|
96
|
+
# k = 0
|
97
|
+
# s = 0
|
98
|
+
# while k < r[j].size
|
99
|
+
# s = s + r[j][k]
|
100
|
+
# k = k + 1
|
101
|
+
# end
|
102
|
+
# suma << s
|
103
|
+
# j = j + 1
|
104
|
+
# end
|
105
|
+
# suma
|
106
|
+
# end
|
107
|
+
suma = []
|
108
|
+
j = 0
|
109
|
+
#puts "locoloco #{r}"
|
110
|
+
alimentos_usuario.each_with_index do |valor, j|
|
111
|
+
k = 0
|
112
|
+
s = 0
|
113
|
+
p = valor.reduce(:+)
|
114
|
+
# alimentos_usuario.each_with_index do |valor2,k|
|
115
|
+
# s = s + r[j][k]
|
116
|
+
# #valor2
|
117
|
+
# #s = r.reduce(:+)
|
118
|
+
# #k = k + 1
|
119
|
+
# end
|
120
|
+
suma << p
|
121
|
+
#j = j+1
|
122
|
+
#puts "locoloco #{p}"
|
123
|
+
end
|
124
|
+
suma
|
125
|
+
#suma = r.reduce {:+}
|
126
|
+
#puts (suma)
|
127
|
+
end
|
128
|
+
#e
|
129
|
+
|
130
|
+
|
131
|
+
def IG
|
132
|
+
|
133
|
+
|
134
|
+
a = formula_AIBC(@datos_ind1)
|
135
|
+
b = formula_AIBC(@datos_ind2)
|
136
|
+
#(a b).each_with_index do |i|
|
137
|
+
salida=[]
|
138
|
+
result=[]
|
139
|
+
for i in 1..NUM_ALIMENTOS-1
|
140
|
+
parte1 = (a[i].to_f/a[0].to_f)*100
|
141
|
+
parte2 = (b[i].to_f/b[0].to_f)*100
|
142
|
+
result = ((parte1)+(parte2))/2
|
143
|
+
puts "alimento #{@alimentos_texto[i]} valor IG #{result}"
|
144
|
+
#salida.insert (result)
|
145
|
+
end
|
146
|
+
|
147
|
+
# a.zip(b).each_with_index do |dato,i|
|
148
|
+
# #puts (dato)
|
149
|
+
# parte1 = (a[i+1].to_f/a[0].to_f)*100
|
150
|
+
# parte2 = (b[i+1].to_f/b[0].to_f)*100
|
151
|
+
# result = ((parte1)+(parte2))/2
|
152
|
+
# puts "alimento #{@alimentos_texto[i+1]} valor IG #{result}"
|
153
|
+
# end
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
#kaka = formula_AIBC(@datos_ind1[i][j],i)
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
@prueba = Glucemico.new
|
166
|
+
#puts "prueba #{@prueba.formula_AIBC}"
|
167
|
+
@prueba.IG
|
168
|
+
#puts (@prueba.ind2_compota_manzana)
|
169
|
+
|
170
|
+
#puts "prueba2 #{@prueba.IG}"
|
171
|
+
#puts "prueba #{formula_IG}"
|
172
|
+
#puts "prueba #{@prueba.datos_ind1[0][0]}"
|
173
|
+
|
174
|
+
#puts (@prueba.aibc)s
|
175
|
+
|
176
|
+
#puts "IG_yogurt #{IG_yogurt}"
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
# # esta formula se aplica para dos individuo
|
181
|
+
#
|
182
|
+
# def self.formula_IG (alimento)
|
183
|
+
# result = 0
|
184
|
+
# result = (formula_IG_IND(alimento))/ 2
|
185
|
+
#
|
186
|
+
# #result = (formula_IG_IND(@compota_manzana) + formula_IG_IND(@yogurt) + formula_IG_IND(@chocolate)) / 2
|
187
|
+
# return (result)
|
188
|
+
# end
|
189
|
+
#
|
190
|
+
# # def + (other)
|
191
|
+
# # Glucemico.new(individuo+other.individuo,tiempo+other.tiempo,compota_manzana+other.compota_manzana,yogurt+other.yogurt,
|
192
|
+
# # chocolate+other.chocolate,glucosa+other.glucosa)
|
193
|
+
# # end
|
194
|
+
#
|
195
|
+
#
|
196
|
+
# ##################################################################################################
|
197
|
+
# def individuo_to_s
|
198
|
+
# imprime = "individuo: #{formula_IG(@individuo)}\n" #número de porciones
|
199
|
+
#
|
200
|
+
# return imprime
|
201
|
+
# end
|
202
|
+
#
|
203
|
+
# def formula_AIBC_to_s (alimento)
|
204
|
+
# imprime = "#{formula_AIBC(alimento)}" #formula
|
205
|
+
#
|
206
|
+
# return imprime
|
207
|
+
# end
|
208
|
+
#
|
209
|
+
# def formula_IG_IND_to_s (alimento)
|
210
|
+
# imprime = "#{formula_IG_IND(alimento)}" #formula
|
211
|
+
#
|
212
|
+
# return imprime
|
213
|
+
# end
|
214
|
+
#
|
215
|
+
# def formula_IG_to_s
|
216
|
+
# imprime = "#{formula_IG(alimento)}" #formula
|
217
|
+
#
|
218
|
+
# return imprime
|
219
|
+
# end
|
220
|
+
#
|
221
|
+
#
|
222
|
+
# # def ingredientes_to_s
|
223
|
+
# # imprime = "\n"
|
224
|
+
# # imprime << "Ingredientes:\n"
|
225
|
+
# # imprime << "#{ingredientes.join(', ')}\n\n" #con el join añade la , y el espacio entre los elementos del array
|
226
|
+
#
|
227
|
+
#
|
228
|
+
#
|
229
|
+
# # def instrucciones_to_s
|
230
|
+
# # imprime = "Instrucciones:\n"
|
231
|
+
# # instrucciones.each_with_index do |instruccion, index| #nos da el valor de cada elemento del array y su indice
|
232
|
+
# # imprime << "#{index + 1}) #{instruccion}\n" #index + 1 para que no empiece en 0
|
233
|
+
# # end
|
234
|
+
#
|
235
|
+
#
|
236
|
+
#
|
237
|
+
#
|
238
|
+
# def to_s
|
239
|
+
#
|
240
|
+
# return (individuo_to_s + indice_compota_manzana_to_s + indice_yogurt_to_s + indice_chocolate_to_s )
|
241
|
+
#
|
242
|
+
# end
|
243
|
+
# end
|
244
|
+
#
|
245
|
+
#
|
246
|
+
# # class individuo
|
247
|
+
# # attr_accessor :ind
|
248
|
+
# #
|
249
|
+
# # def initialize(ind)
|
250
|
+
# # @ind = ind
|
251
|
+
# # end
|
252
|
+
# # def formula_IG_to_s
|
253
|
+
# # imprime = "#{formula_IG(alimento)}" #formula
|
254
|
+
# #
|
255
|
+
# # return imprime
|
256
|
+
# # end
|
257
|
+
# #
|
258
|
+
# # def formula_IG_IND_to_s (alimento)
|
259
|
+
# # imprime = "#{formula_IG_IND(alimento)}" #formula
|
260
|
+
# #
|
261
|
+
# # return imprime
|
262
|
+
# # end
|
263
|
+
# # end
|
264
|
+
#
|
265
|
+
#
|
266
|
+
#
|
267
|
+
#
|
268
|
+
# # individuo,tiempo,compota_manzana,yogurt,chocolate,glucosa
|
269
|
+
#
|
270
|
+
# @tiempo = %w[0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120]
|
271
|
+
# @ind1_compota_manzana = %w[6.7 6.5 6.8 6.9 7.0 7.1 6.9 6.9 6.9 6.7 6.9 7.3 7.0 7.0 7.2 7.1 6.8 7.2 7.3 7.0 6.8 6.7 6.8 6.7 6.9]
|
272
|
+
# @ind1_yogurt = %w[6.1 6.6 6.3 6.3 6.1 6.9 6.8 6.5 6.4 6.9 6.8 6.5 6.3 6.2 6.7 6.2 5.9 5.8 5.8 5.8 5.8 5.8 5.9 6.2 6.4]
|
273
|
+
# @ind1_chocolate = %w[6.5 6.5 6.7 6.5 6.5 6.8 6.7 6.2 6.5 7.2 6.9 7.0 6.3 6.2 6.1 5.9 5.8 6.1 6.7 6.7 6.6 6.7 6.9 7.2 7.1]
|
274
|
+
# @ind1_glucosa = %w[4.9 5.3 5.9 6.7 7.2 7.6 8.0 8.2 8.2 8.4 8.3 8.3 8.0 7.5 7.1 6.8 6.8 6.9 6.8 6.3 6.2 6.3 6.2 6.3 6.1]
|
275
|
+
# @individuo1 = Glucemico.new("ind1",@tiempo , @ind1_compota_manzana , @ind1_yogurt , @ind1_chocolate , @ind1_glucosa)
|
276
|
+
# # acordarse de quitar espacio en blanco en el new(
|
277
|
+
# #puts @individuo1
|
278
|
+
# puts (Glucemico.description)
|
279
|
+
# puts
|
280
|
+
# puts "AIBC_compota_manzana #{@individuo1.formula_AIBC(@ind1_compota_manzana)}"
|
281
|
+
# puts "AIBC_yogurt #{@individuo1.formula_AIBC(@ind1_yogurt)}"
|
282
|
+
# puts "AIBC_chocolate #{@individuo1.formula_AIBC(@ind1_chocolate)}"
|
283
|
+
# # puts "Compota de manzana #{@individuo1.formula_AIBC (@ind1_compota_manzana)}"
|
284
|
+
# # puts "yogurt #{@individuo1.formula_AIBC (@ind1_yogurt)}"
|
285
|
+
# # puts "chocolate #{@individuo1.formula_AIBC (@ind1_chocolate)}"
|
286
|
+
# # puts "glucosa #{@individuo1.formula_AIBC (@ind1_glucosa)}"
|
287
|
+
#
|
288
|
+
# puts "IG_IND_compota_manzana #{@individuo1.formula_IG_IND(@ind1_compota_manzana)}"
|
289
|
+
# puts "IG_IND_yogurt #{@individuo1.formula_IG_IND(@ind1_yogurt)}"
|
290
|
+
# puts "IG_IND_chocolate #{@individuo1.formula_IG_IND(@ind1_chocolate)}"
|
291
|
+
#
|
292
|
+
# #puts "#{@individuo1.to_s()}"
|
293
|
+
#
|
294
|
+
# # puts "Compota de manzana #{individuo1.formula_IG (@ind1_compota_manzana)}"
|
295
|
+
# # puts "yogurt #{individuo1.formula_IG (@ind1_yogurt)}"
|
296
|
+
# # puts "chocolate #{individuo1.formula_IG (@ind1_chocolate)}"
|
297
|
+
# # puts "glucosa #{individuo1.formula_IG (@ind1_glucosa)}"
|
298
|
+
# @ind2_compota_manzana = %w[4.6 4.8 5.3 5.6 6.1 6.5 6.6 7.0 7.0 6.8 6.4 6.3 6.1 6.1 6.2 6.0 6.1 6.1 6.2 6.3 6.4 6.1 6.1 5.7 5.9]
|
299
|
+
# @ind2_yogurt = %w[4.9 4.9 5.2 5.8 6.5 7.0 7.2 7.3 7.3 6.6 6.2 6.1 6.0 6.1 5.9 5.9 5.9 5.9 5.8 5.8 5.5 5.5 5.6 5.9 5.9]
|
300
|
+
# @ind2_chocolate = %w[4.6 4.6 4.7 4.7 4.8 4.7 4.8 4.8 4.6 4.4 4.7 4.7 4.8 4.7 5.2 5.9 5.9 5.7 5.4 5.3 5.1 4.8 4.8 4.9 5.9]
|
301
|
+
# @ind2_glucosa = %w[6.3 5.4 5.6 5.7 6.5 7.4 7.9 7.4 7.7 7.9 7.9 7.8 7.8 7.8 8.0 8.5 9.4 10.8 10.5 9.1 8.9 8.3 7.7 7.6 7.5]
|
302
|
+
# @individuo2 = Glucemico.new("ind2",@tiempo,@ind2_compota_manzana,@ind2_yogurt,@ind2_chocolate,@ind2_glucosa)
|
303
|
+
#
|
304
|
+
# IG_compota_manzana = (@individuo1.formula_AIBC(@ind1_compota_manzana) + @individuo2.formula_AIBC(@ind1_compota_manzana))/2
|
305
|
+
# puts "IG_compota_manzana #{IG_compota_manzana}"
|
306
|
+
#
|
307
|
+
# IG_yogurt = (@individuo1.formula_AIBC(@ind1_yogurt) + @individuo2.formula_AIBC(@ind2_yogurt))/2
|
308
|
+
# puts "IG_yogurt #{IG_yogurt}"
|
309
|
+
#
|
310
|
+
# IG_chocolate = (@individuo1.formula_AIBC(@ind1_chocolate) + @individuo2.formula_AIBC(@ind2_chocolate))/2
|
311
|
+
# puts "IG_chocolate #{IG_chocolate}"
|
312
|
+
#
|
313
|
+
# # IG_compota_manzana = ([@individuo1,@individuo2])
|
314
|
+
# # @individuo = individuo.new(IG_compota_manzana)
|
315
|
+
# # puts (@individuo)
|
316
|
+
#
|
317
|
+
# #result = @individuo1 + @individuo2
|
318
|
+
# #puts (result.to_s)
|
319
|
+
# @tiempo = %w[0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120]
|
320
|
+
#
|
321
|
+
# @individuo1 = 'ind1'
|
322
|
+
# @ind1_compota_manzana = %w[6.7 6.5 6.8 6.9 7.0 7.1 6.9 6.9 6.9 6.7 6.9 7.3 7.0 7.0 7.2 7.1 6.8 7.2 7.3 7.0 6.8 6.7 6.8 6.7 6.9]
|
323
|
+
# @ind1_yogurt = %w[6.1 6.6 6.3 6.3 6.1 6.9 6.8 6.5 6.4 6.9 6.8 6.5 6.3 6.2 6.7 6.2 5.9 5.8 5.8 5.8 5.8 5.8 5.9 6.2 6.4]
|
324
|
+
# @ind1_chocolate = %w[6.5 6.5 6.7 6.5 6.5 6.8 6.7 6.2 6.5 7.2 6.9 7.0 6.3 6.2 6.1 5.9 5.8 6.1 6.7 6.7 6.6 6.7 6.9 7.2 7.1]
|
325
|
+
# @ind1_glucosa = %w[4.9 5.3 5.9 6.7 7.2 7.6 8.0 8.2 8.2 8.4 8.3 8.3 8.0 7.5 7.1 6.8 6.8 6.9 6.8 6.3 6.2 6.3 6.2 6.3 6.1]
|
326
|
+
# @datos_ind1 = [@individuo1,@tiempo,@ind1_compota_manzana,@ind1_yogurt,@ind1_chocolate,@ind1_glucosa]
|
327
|
+
#
|
328
|
+
# @individuo2 = 'ind2'
|
329
|
+
# @ind2_compota_manzana = %w[4.6 4.8 5.3 5.6 6.1 6.5 6.6 7.0 7.0 6.8 6.4 6.3 6.1 6.1 6.2 6.0 6.1 6.1 6.2 6.3 6.4 6.1 6.1 5.7 5.9]
|
330
|
+
# @ind2_yogurt = %w[4.9 4.9 5.2 5.8 6.5 7.0 7.2 7.3 7.3 6.6 6.2 6.1 6.0 6.1 5.9 5.9 5.9 5.9 5.8 5.8 5.5 5.5 5.6 5.9 5.9]
|
331
|
+
# @ind2_chocolate = %w[4.6 4.6 4.7 4.7 4.8 4.7 4.8 4.8 4.6 4.4 4.7 4.7 4.8 4.7 5.2 5.9 5.9 5.7 5.4 5.3 5.1 4.8 4.8 4.9 5.9]
|
332
|
+
# @ind2_glucosa = %w[6.3 5.4 5.6 5.7 6.5 7.4 7.9 7.4 7.7 7.9 7.9 7.8 7.8 7.8 8.0 8.5 9.4 10.8 10.5 9.1 8.9 8.3 7.7 7.6 7.5]
|
333
|
+
# @datos_ind2 = [@individuo2,@tiempo,@ind2_compota_manzana,@ind2_yogurt,@ind2_chocolate,@ind2_glucosa]
|