nutrientesEugenio 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef6f59da7219c7fec309a3e7236bed046145427a
4
- data.tar.gz: ec8f0705f68486ba86b58f4d10c8939304d9ec2e
3
+ metadata.gz: 0c574aea9ba31183ff816ac13fb8db8dcfd0fe64
4
+ data.tar.gz: 51a1ce6737b5f7460b93c832fd528db920ec6a3a
5
5
  SHA512:
6
- metadata.gz: d0d15de6e79e5dca850f659e9d316d4ecad9527bdb7992a9e926a1c7961f7ab84091173115619c66b718c171d5bcb6d3fe9ea877d32090ecaea17dcba2790582
7
- data.tar.gz: 7e6fc03d0f5d347524477169cb0f08f413edd89acaffea28280cdd38cb5ec9cd0e5a208d14be6cb44eef807d513cf62e76d5406a617fbb95dc5de5a413a876a1
6
+ metadata.gz: fd972d9882069483c3f56c14255738d896c08ce2c924601c9d041db9727cdebe493217e13881bbf9603140457833984e547152865cda39f7cf38964d29097404
7
+ data.tar.gz: 4abc5a38f657103f7c3bfa42812e2db95d2ccfa1e016dab1172e9b8fad212d1aaa6a104cb6eab54603bd67ef09aec35a44e104bd4de84fb7cc6d3177f0d43856
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nutrientesEugenio (0.1.1)
4
+ nutrientesEugenio (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- @desayuno.push_head(Alimento.new(options[:descripcion],options[:grasas],0,options[:carbohidratos],0,options[:proteinas],options[:sal]))
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
- @almuerzo.push_head(Alimento.new(options[:descripcion],options[:grasas],0,options[:carbohidratos],0,options[:proteinas],options[:sal]))
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
- @cena.push_head(Alimento.new(options[:descripcion],options[:grasas],0,options[:carbohidratos],0,options[:proteinas],options[:sal]))
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
@@ -1,7 +1,7 @@
1
1
  require "imc"
2
2
 
3
3
  module NutrientesEugenio
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
 
7
7
  class Lista
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutrientesEugenio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugenio José