residence 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,4 +5,4 @@ require 'cucumber'
5
5
  require 'cucumber/formatter/unicode'
6
6
 
7
7
  require 'sniff'
8
- Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :earth => [:residence, :locality]
8
+ Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :earth => [:residence, :locality], :cucumber => true
@@ -32,7 +32,7 @@ module BrighterPlanet
32
32
  characteristics[:reported_annual_fuel_oil_consumption] * (timeframe / timeframe.year)
33
33
  end
34
34
  quorum 'from research', :needs => [:predicted_annual_fuel_oil_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
35
- (characteristics[:predicted_annual_fuel_oil_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:fuel_oil]).joules.to(:litres_of_fuel_oil) ) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
35
+ (characteristics[:predicted_annual_fuel_oil_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:fuel_oil]).joules.to(:litres_of_fuel_oil) ) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
36
36
  end
37
37
  end
38
38
 
@@ -41,7 +41,7 @@ module BrighterPlanet
41
41
  characteristics[:reported_annual_natural_gas_consumption] * (timeframe / timeframe.year)
42
42
  end
43
43
  quorum 'from research', :needs => [:predicted_annual_natural_gas_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
44
- (characteristics[:predicted_annual_natural_gas_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:natural_gas])) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
44
+ (characteristics[:predicted_annual_natural_gas_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:natural_gas])) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
45
45
  end
46
46
  end
47
47
 
@@ -50,7 +50,7 @@ module BrighterPlanet
50
50
  characteristics[:reported_annual_propane_consumption] * (timeframe / timeframe.year)
51
51
  end
52
52
  quorum 'from research', :needs => [:predicted_annual_propane_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
53
- (characteristics[:predicted_annual_propane_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:propane]).joules.to(:litres_of_propane)) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
53
+ (characteristics[:predicted_annual_propane_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:propane]).joules.to(:litres_of_propane)) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
54
54
  end
55
55
  end
56
56
 
@@ -59,7 +59,7 @@ module BrighterPlanet
59
59
  characteristics[:reported_annual_biomass_consumption] * (timeframe / timeframe.year)
60
60
  end
61
61
  quorum 'from research', :needs => [:predicted_annual_biomass_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
62
- (characteristics[:predicted_annual_biomass_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:biomass])) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
62
+ (characteristics[:predicted_annual_biomass_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:biomass])) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
63
63
  end
64
64
  end
65
65
 
@@ -68,7 +68,7 @@ module BrighterPlanet
68
68
  characteristics[:reported_annual_kerosene_consumption] * (timeframe / timeframe.year)
69
69
  end
70
70
  quorum 'from research', :needs => [:predicted_annual_kerosene_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
71
- (characteristics[:predicted_annual_kerosene_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:kerosene]).joules.to(:litres_of_kerosene)) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
71
+ (characteristics[:predicted_annual_kerosene_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:kerosene]).joules.to(:litres_of_kerosene)) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
72
72
  end
73
73
  end
74
74
 
@@ -77,7 +77,7 @@ module BrighterPlanet
77
77
  characteristics[:reported_annual_coal_consumption] * (timeframe / timeframe.year)
78
78
  end
79
79
  quorum 'from research', :needs => [:predicted_annual_coal_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
80
- (characteristics[:predicted_annual_coal_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:coal]).joules.to(:kilograms_of_coal)) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
80
+ (characteristics[:predicted_annual_coal_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:coal]).joules.to(:kilograms_of_coal)) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
81
81
  end
82
82
  end
83
83
 
@@ -89,7 +89,7 @@ module BrighterPlanet
89
89
 
90
90
  committee :green_electricity do
91
91
  quorum 'default' do
92
- Residence.residence_model.fallback.green_electricity
92
+ base.fallback.green_electricity
93
93
  end
94
94
  end
95
95
 
@@ -105,7 +105,7 @@ module BrighterPlanet
105
105
  end
106
106
 
107
107
  quorum 'from research', :needs => [:predicted_annual_electricity_use, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
108
- (characteristics[:predicted_annual_electricity_use] + ((characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:electricity]).joules.to(:kilowatt_hours))) * (timeframe / timeframe.year) * characteristics[:occupation] / Residence.residence_model.fallback.occupation
108
+ (characteristics[:predicted_annual_electricity_use] + ((characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:electricity]).joules.to(:kilowatt_hours))) * (timeframe / timeframe.year) * characteristics[:occupation] / base.fallback.occupation
109
109
  end
110
110
  end
111
111
 
@@ -171,7 +171,7 @@ module BrighterPlanet
171
171
 
172
172
  committee :occupation do
173
173
  quorum 'default' do
174
- Residence.residence_model.fallback.occupation
174
+ base.fallback.occupation
175
175
  end
176
176
  end
177
177
 
@@ -181,7 +181,7 @@ module BrighterPlanet
181
181
  end
182
182
 
183
183
  quorum 'default' do
184
- Residence.residence_model.fallback.residents_before_type_cast
184
+ base.fallback.residents_before_type_cast
185
185
  end
186
186
  end
187
187
 
@@ -243,7 +243,7 @@ module BrighterPlanet
243
243
  end
244
244
 
245
245
  quorum 'default' do
246
- Residence.residence_model.fallback.annual_fuel_oil_volume_estimate
246
+ base.fallback.annual_fuel_oil_volume_estimate
247
247
  end
248
248
  end
249
249
 
@@ -272,7 +272,7 @@ module BrighterPlanet
272
272
  end
273
273
 
274
274
  quorum 'default' do
275
- Residence.residence_model.fallback.monthly_natural_gas_volume_estimate * 12
275
+ base.fallback.monthly_natural_gas_volume_estimate * 12
276
276
  end
277
277
  end
278
278
 
@@ -301,7 +301,7 @@ module BrighterPlanet
301
301
  end
302
302
 
303
303
  quorum 'default' do
304
- Residence.residence_model.fallback.annual_propane_volume_estimate
304
+ base.fallback.annual_propane_volume_estimate
305
305
  end
306
306
  end
307
307
 
@@ -317,7 +317,7 @@ module BrighterPlanet
317
317
  end
318
318
 
319
319
  quorum 'default' do
320
- Residence.residence_model.fallback.annual_kerosene_volume_estimate
320
+ base.fallback.annual_kerosene_volume_estimate
321
321
  end
322
322
  end
323
323
 
@@ -333,7 +333,7 @@ module BrighterPlanet
333
333
  end
334
334
 
335
335
  quorum 'default' do
336
- Residence.residence_model.fallback.annual_wood_volume_estimate
336
+ base.fallback.annual_wood_volume_estimate
337
337
  end
338
338
  end
339
339
 
@@ -345,7 +345,7 @@ module BrighterPlanet
345
345
 
346
346
  committee :predicted_annual_coal_consumption do # returns kg
347
347
  quorum 'default' do
348
- Residence.residence_model.fallback.annual_coal_volume_estimate
348
+ base.fallback.annual_coal_volume_estimate
349
349
  end
350
350
  end
351
351
 
@@ -443,7 +443,7 @@ module BrighterPlanet
443
443
  end
444
444
 
445
445
  quorum 'default' do
446
- Residence.residence_model.fallback.monthly_electricity_use_estimate * 12
446
+ base.fallback.monthly_electricity_use_estimate * 12
447
447
  end
448
448
  end
449
449
 
@@ -471,14 +471,14 @@ module BrighterPlanet
471
471
 
472
472
  # This is kindof "hacky"
473
473
  # As implemented, this needs to be above floorspace committee or else cohort will always
474
- # use the Residence.residence_model.fallback
474
+ # use the base.fallback
475
475
  committee :floorspace_estimate do
476
476
  quorum 'from cohort', :needs => :cohort do |characteristics|
477
477
  characteristics[:cohort].weighted_average :floorspace
478
478
  end
479
479
 
480
480
  quorum 'default' do
481
- Residence.residence_model.fallback.floorspace_estimate
481
+ base.fallback.floorspace_estimate
482
482
  end
483
483
  end
484
484
 
data/lib/residence.rb CHANGED
@@ -3,15 +3,5 @@ require 'emitter'
3
3
  module BrighterPlanet
4
4
  module Residence
5
5
  extend BrighterPlanet::Emitter
6
-
7
- def self.residence_model
8
- if Object.const_defined? 'Residence'
9
- ::Residence
10
- elsif Object.const_defined? 'ResidenceRecord'
11
- ResidenceRecord
12
- else
13
- raise 'There is no residence model'
14
- end
15
- end
16
6
  end
17
7
  end
@@ -1,4 +1,5 @@
1
1
  require 'residence'
2
+ require 'falls_back_on'
2
3
 
3
4
  class ResidenceRecord < ActiveRecord::Base
4
5
  include Sniff::Emitter
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: residence
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Rossmeissl
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-08-15 00:00:00 -04:00
22
+ date: 2010-08-31 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- hash: 299253624
33
+ hash: -1848230024
34
34
  segments:
35
35
  - 3
36
36
  - 0
@@ -159,12 +159,12 @@ dependencies:
159
159
  requirements:
160
160
  - - ">="
161
161
  - !ruby/object:Gem::Version
162
- hash: 29
162
+ hash: 15
163
163
  segments:
164
164
  - 0
165
165
  - 0
166
- - 1
167
- version: 0.0.1
166
+ - 8
167
+ version: 0.0.8
168
168
  type: :runtime
169
169
  version_requirements: *id009
170
170
  description: A software model in Ruby for the greenhouse gas emissions of an residence