earth 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/earth.gemspec +1 -1
- data/lib/earth.rb +0 -19
- data/lib/earth/automobile/automobile_fuel.rb +0 -9
- data/spec/earth_spec.rb +0 -4
- metadata +3 -3
data/earth.gemspec
CHANGED
data/lib/earth.rb
CHANGED
@@ -121,27 +121,8 @@ private
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def load_schemas(options = {})
|
124
|
-
force_fallback_table
|
125
124
|
load_data_miner_schemas(options)
|
126
125
|
end
|
127
|
-
|
128
|
-
# sabshere 9/17/10 this sucks. the falls_back_on gem sucks.
|
129
|
-
def force_fallback_table
|
130
|
-
c = ActiveRecord::Base.connection
|
131
|
-
if c.table_exists? 'fallbacks'
|
132
|
-
raise "The earth gem expects a different schema for the fallbacks table." unless c.column_exists?('fallbacks', 'name') and
|
133
|
-
c.column_exists?('fallbacks', 'values') and
|
134
|
-
c.column_exists?('fallbacks', 'created_at') and
|
135
|
-
c.column_exists?('fallbacks', 'updated_at')
|
136
|
-
else
|
137
|
-
c.create_table 'fallbacks' do |t|
|
138
|
-
t.string 'name'
|
139
|
-
t.text 'values'
|
140
|
-
t.datetime 'created_at'
|
141
|
-
t.datetime 'updated_at'
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
126
|
|
146
127
|
def load_data_miner_schemas(options = {})
|
147
128
|
models = Module.constants.select do |k|
|
@@ -31,15 +31,6 @@ class AutomobileFuel < ActiveRecord::Base
|
|
31
31
|
diesel_use / (gas_use + diesel_use)
|
32
32
|
end
|
33
33
|
|
34
|
-
def fallback_annual_distance
|
35
|
-
(AutomobileFuel.find_by_code("R").annual_distance * (1 - AutomobileFuel.fallback_blend_portion)) +
|
36
|
-
(AutomobileFuel.find_by_code("D").annual_distance * AutomobileFuel.fallback_blend_portion)
|
37
|
-
end
|
38
|
-
|
39
|
-
def fallback_annual_distance_units
|
40
|
-
AutomobileFuel.find_by_code("R").annual_distance_units
|
41
|
-
end
|
42
|
-
|
43
34
|
def fallback_co2_emission_factor
|
44
35
|
(Fuel.find_by_name("Motor Gasoline").co2_emission_factor * (1 - AutomobileFuel.fallback_blend_portion)) +
|
45
36
|
(Fuel.find_by_name("Distillate Fuel Oil No. 2").co2_emission_factor * AutomobileFuel.fallback_blend_portion)
|
data/spec/earth_spec.rb
CHANGED
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:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 4
|
10
|
+
version: 0.4.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Seamus Abshere
|