Class: ResidenceAppliance

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Earth::Model
Defined in:
lib/earth/residence/residence_appliance.rb

Constant Summary collapse

TABLE_STRUCTURE =
<<-EOS

CREATE TABLE residence_appliances
  (
     name                                 CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     annual_energy_from_electricity       FLOAT,
     annual_energy_from_electricity_units CHARACTER VARYING(255)
  );

EOS

Class Method Summary collapse

Methods included from Earth::Model

extend_mining, extended, registry

Class Method Details

.annual_energy_from_electricity_for(appliance_plural) ⇒ Object



20
21
22
23
24
25
# File 'lib/earth/residence/residence_appliance.rb', line 20

def annual_energy_from_electricity_for(appliance_plural)
  appliance_name = appliance_plural.to_s.singularize
  if appliance = find_by_name(appliance_name)
    appliance.annual_energy_from_electricity
  end
end