class EnvImpact
Attributes
ch_g[RW]
gei[RW]
lp_g[RW]
name[RW]
pr_g[RW]
terrain[RW]
Public Class Methods
new(name, pr_g, ch_g, lp_g , gei, terrain)
click to toggle source
# File lib/EnvImpact.rb, line 10 def initialize(name, pr_g, ch_g, lp_g , gei, terrain) @name = name @pr_g, @ch_g, @lp_g = pr_g, ch_g, lp_g @gei, @terrain = gei, terrain end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/EnvImpact.rb, line 28 def <=>(other) return nil unless other.instance_of? EnvImpact n_value + e_value <=> other.n_value + other.e_value end
e_value()
click to toggle source
# File lib/EnvImpact.rb, line 24 def e_value (gei + terrain) end
n_value()
click to toggle source
# File lib/EnvImpact.rb, line 20 def n_value (@pr_g*4 + @ch_g*4 + lp_g*9) end
to_s()
click to toggle source
# File lib/EnvImpact.rb, line 16 def to_s "#{name} =>| Proteinas/g: #{pr_g} | Carbohidratos/g: #{ch_g} | Lipidos/g: #{lp_g} | GEI: #{gei} | m²/año: #{terrain}" end