earth 0.0.27 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,17 @@ class ClothesMachineUse < ActiveRecord::Base
4
4
  has_many :residences
5
5
  has_many :residential_energy_consumption_survey_responses
6
6
 
7
+ class << self
8
+ def derive_annual_energy_from_electricity_for_clothes_driers
9
+ find_in_batches do |batch|
10
+ batch.each do |record|
11
+ record.annual_energy_from_electricity_for_clothes_driers = ResidenceSurveyResponse.cohort(:clothes_drier_use => record).weighted_average :annual_energy_from_electricity_for_clothes_driers
12
+ record.save
13
+ end
14
+ end
15
+ end
16
+ end
17
+
7
18
  data_miner do
8
19
  schema do
9
20
  string 'name'
@@ -1,6 +1,15 @@
1
1
  class ResidenceAppliance < ActiveRecord::Base
2
2
  set_primary_key :name
3
3
 
4
+ class << self
5
+ def annual_energy_from_electricity_for(appliance_plural)
6
+ appliance_name = appliance_plural.to_s.singularize
7
+ if appliance = find_by_name(appliance_name)
8
+ appliance.annual_energy_from_electricity
9
+ end
10
+ end
11
+ end
12
+
4
13
  data_miner do
5
14
  tap "Brighter Planet's residence appliance energy information", Earth.taps_server
6
15
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earth
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 39
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 27
10
- version: 0.0.27
9
+ - 28
10
+ version: 0.0.28
11
11
  platform: ruby
12
12
  authors:
13
13
  - Seamus Abshere
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-08-26 00:00:00 -04:00
20
+ date: 2010-08-31 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency