earth 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,23 @@
1
1
  class LodgingClass < ActiveRecord::Base
2
+ extend Earth::Base
3
+
2
4
  set_primary_key :name
3
5
 
4
6
  has_many :lodgings
7
+
8
+ def self.schema_definition
9
+ lambda do
10
+ string 'name'
11
+ float 'natural_gas_intensity'
12
+ string 'natural_gas_intensity_units'
13
+ float 'fuel_oil_intensity'
14
+ string 'fuel_oil_intensity_units'
15
+ float 'electricity_intensity'
16
+ string 'electricity_intensity_units'
17
+ float 'district_heat_intensity'
18
+ string 'district_heat_intensity_units'
19
+ end
20
+ end
5
21
 
6
22
  data_miner do
7
23
  tap "Brighter Planet's lodging class data", Earth.taps_server
@@ -1,16 +1,6 @@
1
1
  LodgingClass.class_eval do
2
2
  data_miner do
3
- schema Earth.database_options do
4
- string 'name'
5
- float 'natural_gas_intensity'
6
- string 'natural_gas_intensity_units'
7
- float 'fuel_oil_intensity'
8
- string 'fuel_oil_intensity_units'
9
- float 'electricity_intensity'
10
- string 'electricity_intensity_units'
11
- float 'district_heat_intensity'
12
- string 'district_heat_intensity_units'
13
- end
3
+ LodgingClass.define_schema(self)
14
4
 
15
5
  process "Define some unit conversions" do
16
6
  Conversions.register :hundred_cubic_feet_per_room_night, :cubic_metres_per_room_night, 2.831685
@@ -20,4 +20,9 @@ class Industry < ActiveRecord::Base
20
20
  data_miner do
21
21
  Industry.define_schema(self)
22
22
  end
23
+
24
+ def trade_industry?
25
+ prefix = naics_code.to_s[0,2]
26
+ %w{42 44 45}.include?(prefix)
27
+ end
23
28
  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: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
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-09-24 00:00:00 -07:00
20
+ date: 2010-10-04 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency