Class: Etiqueta
- Inherits:
-
Object
- Object
- Etiqueta
- Includes:
- Comparable
- Defined in:
- lib/gema/etiqueta_nutricional.rb
Instance Attribute Summary collapse
-
#almidon ⇒ Object
readonly
Returns the value of attribute almidon.
-
#azucares ⇒ Object
readonly
Returns the value of attribute azucares.
-
#fibra_alimentaria ⇒ Object
readonly
Returns the value of attribute fibra_alimentaria.
-
#grasa ⇒ Object
readonly
Returns the value of attribute grasa.
-
#hidratos ⇒ Object
readonly
Returns the value of attribute hidratos.
-
#monoinsaturadas ⇒ Object
readonly
Returns the value of attribute monoinsaturadas.
-
#nombre ⇒ Object
readonly
Returns the value of attribute nombre.
-
#polialcoholes ⇒ Object
readonly
Returns the value of attribute polialcoholes.
-
#poliinsaturadas ⇒ Object
readonly
Returns the value of attribute poliinsaturadas.
-
#porcion ⇒ Object
readonly
Returns the value of attribute porcion.
-
#proteinas ⇒ Object
readonly
Returns the value of attribute proteinas.
-
#sal ⇒ Object
readonly
Returns the value of attribute sal.
-
#saturadas ⇒ Object
readonly
Returns the value of attribute saturadas.
-
#valor_energetico ⇒ Object
readonly
Returns the value of attribute valor_energetico.
-
#valor_porcion ⇒ Object
readonly
Returns the value of attribute valor_porcion.
-
#vit_min ⇒ Object
readonly
Returns the value of attribute vit_min.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #gt_6? ⇒ Boolean
-
#initialize(nombre, grasa, saturadas, hidratos, proteinas, azucares, sal, porcion, monoinsaturadas, poliinsaturadas, fibra_alimentaria, polialcoholes, almidon, vit_min) ⇒ Etiqueta
constructor
A new instance of Etiqueta.
- #porcion_kc ⇒ Object
- #porcion_kJ ⇒ Object
- #to_s ⇒ Object
- #v_energeticokc ⇒ Object
- #v_energeticokJ ⇒ Object
Constructor Details
#initialize(nombre, grasa, saturadas, hidratos, proteinas, azucares, sal, porcion, monoinsaturadas, poliinsaturadas, fibra_alimentaria, polialcoholes, almidon, vit_min) ⇒ Etiqueta
Returns a new instance of Etiqueta.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gema/etiqueta_nutricional.rb', line 4 def initialize(nombre,grasa,saturadas, hidratos, proteinas,azucares, sal,porcion, monoinsaturadas,poliinsaturadas,fibra_alimentaria,polialcoholes,almidon,vit_min) @nombre=nombre @grasa=grasa @saturadas=saturadas @hidratos=hidratos @proteinas=proteinas @azucares=azucares @sal=sal @fibra_alimentaria=fibra_alimentaria @monoinsaturadas=monoinsaturadas @poliinsaturadas=poliinsaturadas @polialcoholes=polialcoholes @almidon=almidon @vit_min=vit_min @valor_energetico=[v_energeticokJ,v_energeticokc] @porcion=porcion/100 @valor_porcion=[porcion_kJ,porcion_kc] @IR=[8400,2000,70,20,260,50,90,6] end |
Instance Attribute Details
#almidon ⇒ Object (readonly)
Returns the value of attribute almidon.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def almidon @almidon end |
#azucares ⇒ Object (readonly)
Returns the value of attribute azucares.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def azucares @azucares end |
#fibra_alimentaria ⇒ Object (readonly)
Returns the value of attribute fibra_alimentaria.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def fibra_alimentaria @fibra_alimentaria end |
#grasa ⇒ Object (readonly)
Returns the value of attribute grasa.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def grasa @grasa end |
#hidratos ⇒ Object (readonly)
Returns the value of attribute hidratos.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def hidratos @hidratos end |
#monoinsaturadas ⇒ Object (readonly)
Returns the value of attribute monoinsaturadas.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def monoinsaturadas @monoinsaturadas end |
#nombre ⇒ Object (readonly)
Returns the value of attribute nombre.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def nombre @nombre end |
#polialcoholes ⇒ Object (readonly)
Returns the value of attribute polialcoholes.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def polialcoholes @polialcoholes end |
#poliinsaturadas ⇒ Object (readonly)
Returns the value of attribute poliinsaturadas.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def poliinsaturadas @poliinsaturadas end |
#porcion ⇒ Object (readonly)
Returns the value of attribute porcion.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def porcion @porcion end |
#proteinas ⇒ Object (readonly)
Returns the value of attribute proteinas.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def proteinas @proteinas end |
#sal ⇒ Object (readonly)
Returns the value of attribute sal.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def sal @sal end |
#saturadas ⇒ Object (readonly)
Returns the value of attribute saturadas.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def saturadas @saturadas end |
#valor_energetico ⇒ Object (readonly)
Returns the value of attribute valor_energetico.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def valor_energetico @valor_energetico end |
#valor_porcion ⇒ Object (readonly)
Returns the value of attribute valor_porcion.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def valor_porcion @valor_porcion end |
#vit_min ⇒ Object (readonly)
Returns the value of attribute vit_min.
3 4 5 |
# File 'lib/gema/etiqueta_nutricional.rb', line 3 def vit_min @vit_min end |
Instance Method Details
#<=>(other) ⇒ Object
42 43 44 45 |
# File 'lib/gema/etiqueta_nutricional.rb', line 42 def <=>(other) return nil unless other.instance_of?Etiqueta @proteinas <=> other.proteinas end |
#gt_6? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/gema/etiqueta_nutricional.rb', line 35 def gt_6? if (@sal >= 6) true else false end end |
#porcion_kc ⇒ Object
32 33 34 |
# File 'lib/gema/etiqueta_nutricional.rb', line 32 def porcion_kc v_energeticokc*@porcion end |
#porcion_kJ ⇒ Object
29 30 31 |
# File 'lib/gema/etiqueta_nutricional.rb', line 29 def porcion_kJ v_energeticokJ*@porcion end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/gema/etiqueta_nutricional.rb', line 46 def to_s "#{@proteinas}" end |
#v_energeticokc ⇒ Object
26 27 28 |
# File 'lib/gema/etiqueta_nutricional.rb', line 26 def v_energeticokc (9.0*@grasa)+(4.0*@hidratos)+(4.0*@proteinas)+(6*@sal) end |
#v_energeticokJ ⇒ Object
23 24 25 |
# File 'lib/gema/etiqueta_nutricional.rb', line 23 def v_energeticokJ (37.0*@grasa)+(17.0*@hidratos)+(17.0*@proteinas)+(25*@sal) end |