Sha256: aaaeedd6f1aec9fbf9bdfe83a328706b6b3ae25ae0fd3fcfde8532b89c9dd285

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

require 'gema'

class PlatoEficienciaEnergetica < Plato
	
	attr_reader :totalEmisiones, :totalTerreno
	
	def initialize(nombre)
		super(nombre)
		@totalEmisiones = 0
		@totalTerreno = 0
	end

	def inserted(value)
		method(:inserted).super_method.call(value) #Llama al metodo insert de padre
		alimento = value
		if(value.instance_of? Node) then alimento = value.value end
			@totalEmisiones += alimento.gei
			@totalTerreno += alimento.terreno
	end

	def extracted(value)
		method(:extracted).super_method.call(value) #Llama al metodo insert de padre
		alimento = value
		if(value.instance_of? Node) then alimento = value.value end
			@totalEmisiones -= alimento.gei
			@totalTerreno -= alimento.terreno
	end

	def to_s
		return method(:to_s).super_method.call + " . #{@totalEmisiones} kgCO2, #{@totalTerreno} m^2"
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prct06-TDD-0.1.0 lib/PlatoEficienciaEnergetica.rb