nutrientesEugenio 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dietaDia.rb +29 -5
- data/lib/nutrientesEugenio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c574aea9ba31183ff816ac13fb8db8dcfd0fe64
|
4
|
+
data.tar.gz: 51a1ce6737b5f7460b93c832fd528db920ec6a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd972d9882069483c3f56c14255738d896c08ce2c924601c9d041db9727cdebe493217e13881bbf9603140457833984e547152865cda39f7cf38964d29097404
|
7
|
+
data.tar.gz: 4abc5a38f657103f7c3bfa42812e2db95d2ccfa1e016dab1172e9b8fad212d1aaa6a104cb6eab54603bd67ef09aec35a44e104bd4de84fb7cc6d3177f0d43856
|
data/Gemfile.lock
CHANGED
data/lib/dietaDia.rb
CHANGED
@@ -8,9 +8,16 @@ require "nutrientesEugenio/version"
|
|
8
8
|
class DietaDia
|
9
9
|
include Comparable
|
10
10
|
|
11
|
-
attr_reader :nombre, :desayuno, :almuerzo, :cena
|
11
|
+
attr_reader :nombre, :desayuno, :almuerzo, :cena, :conversiones
|
12
12
|
|
13
13
|
def initialize(nombre, &bloque)
|
14
|
+
@conversiones = [
|
15
|
+
["1 rodaja", 28],
|
16
|
+
["1 porcion", 100],
|
17
|
+
["1 taza", 200],
|
18
|
+
["1/2 cucharon",20],
|
19
|
+
["1 pieza", 150],
|
20
|
+
["1 vaso", 100]]
|
14
21
|
@nombre = nombre
|
15
22
|
@desayuno = Menu.new()
|
16
23
|
@almuerzo = Menu.new()
|
@@ -67,18 +74,35 @@ class DietaDia
|
|
67
74
|
#Añade un desayuno
|
68
75
|
#@param options información sobre el alimento
|
69
76
|
def desayuno(options = {})
|
70
|
-
|
77
|
+
porcion = 0
|
78
|
+
@conversiones.each do
|
79
|
+
|x|
|
80
|
+
porcion = x[1] if x[0] == options[:porcion]
|
81
|
+
endnaranja peso medionaranja peso medio
|
82
|
+
multiplier = porcion / options[:gramos]
|
83
|
+
@desayuno.push_head(Alimento.new(options[:descripcion],options[:grasas] * multiplier,0,options[:carbohidratos] * multiplier,0,options[:proteinas] * multiplier,options[:sal] * multiplier))
|
71
84
|
end
|
72
85
|
|
73
86
|
#Añade un almuerzo
|
74
87
|
#@param options información sobre el alimento
|
75
88
|
def almuerzo(options = {})
|
76
|
-
|
89
|
+
porcion = 0
|
90
|
+
@conversiones.each do
|
91
|
+
|x|
|
92
|
+
porcion = x[1] if x[0] == options[:porcion]
|
93
|
+
end
|
94
|
+
multiplier = porcion / options[:gramos]
|
95
|
+
@almuerzo.push_head(Alimento.new(options[:descripcion],options[:grasas] * multiplier,0,options[:carbohidratos] * multiplier,0,options[:proteinas] * multiplier,options[:sal] * multiplier))
|
77
96
|
end
|
78
|
-
|
79
97
|
#Añade una cena
|
80
98
|
#@param options información sobre el alimento
|
81
99
|
def cena(options = {})
|
82
|
-
|
100
|
+
porcion = 0
|
101
|
+
@conversiones.each do
|
102
|
+
|x|
|
103
|
+
porcion = x[1] if x[0] == options[:porcion]
|
104
|
+
end
|
105
|
+
multiplier = porcion / options[:gramos]
|
106
|
+
@cena.push_head(Alimento.new(options[:descripcion],options[:grasas] * multiplier,0,options[:carbohidratos] * multiplier,0,options[:proteinas] * multiplier,options[:sal] * multiplier))
|
83
107
|
end
|
84
108
|
end
|