emitter 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/emitter.rb CHANGED
@@ -1,33 +1,12 @@
1
1
  module BrighterPlanet
2
2
  module Emitter
3
- LIST = %w{
4
- automobile
5
- automobile_trip
6
- bus_trip
7
- computation
8
- diet
9
- electricity_use
10
- flight
11
- fuel_purchase
12
- lodging
13
- meeting
14
- motorcycle
15
- pet
16
- purchase
17
- rail_trip
18
- residence
19
- shipment
20
- }
21
- BETA_LIST = %w{}
22
3
  REQUIRED_COMPONENTS = %w{
23
4
  carbon_model
24
5
  characterization
25
6
  data summarization
26
- fallback
27
7
  relationships
28
8
  }
29
9
  def included(base)
30
- base.extend Meta
31
10
  base.extend ClassMethods
32
11
 
33
12
  common_name = self.to_s.split('::').last.underscore
@@ -57,16 +36,16 @@ module BrighterPlanet
57
36
  base.send :include, "::BrighterPlanet::#{common_camel}::Summarization".constantize
58
37
 
59
38
  require 'falls_back_on'
60
- require 'falls_back_on/active_record_ext'
61
- base.send :include, "::BrighterPlanet::#{common_camel}::Fallback".constantize
39
+ begin
40
+ require "#{common_name}/fallback"
41
+ base.send :include, "::BrighterPlanet::#{common_camel}::Fallback".constantize
42
+ rescue ::LoadError
43
+ # not required
44
+ end
62
45
 
63
46
  base.send :include, "::BrighterPlanet::#{common_camel}::Relationships".constantize
64
47
  end
65
-
66
- def self.classes
67
- LIST.map(&:camelize).map(&:constantize)
68
- end
69
-
48
+
70
49
  def scope(statement)
71
50
  @emission_scope = statement
72
51
  end
@@ -80,11 +59,5 @@ module BrighterPlanet
80
59
 
81
60
  def emission_scope; @emission_scope end
82
61
  end
83
-
84
- module Meta
85
- def beta?
86
- BETA_LIST.include?(self.to_s.underscore)
87
- end
88
- end
89
62
  end
90
63
  end
@@ -1,3 +1,3 @@
1
1
  module Emitter
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -2,7 +2,7 @@ module BrighterPlanet
2
2
  module Dirigible
3
3
  module Fallback
4
4
  def self.included(base)
5
- base.falls_back_on :distance => 100
5
+ base.falls_back_on :distance => 100
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Rossmeissl
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-02-14 00:00:00 -05:00
21
+ date: 2011-02-24 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -211,13 +211,11 @@ files:
211
211
  - emitter.gemspec
212
212
  - lib/emitter.rb
213
213
  - lib/emitter/version.rb
214
- - spec/emitter/meta_spec.rb
215
214
  - spec/emitter_spec.rb
216
215
  - spec/fixtures/biplane/lib/biplane.rb
217
216
  - spec/fixtures/biplane/lib/biplane/carbon_model.rb
218
217
  - spec/fixtures/biplane/lib/biplane/characterization.rb
219
218
  - spec/fixtures/biplane/lib/biplane/data.rb
220
- - spec/fixtures/biplane/lib/biplane/fallback.rb
221
219
  - spec/fixtures/biplane/lib/biplane/relationships.rb
222
220
  - spec/fixtures/biplane/lib/biplane/summarization.rb
223
221
  - spec/fixtures/dirigible/lib/dirigible.rb
@@ -242,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
240
  requirements:
243
241
  - - ">="
244
242
  - !ruby/object:Gem::Version
245
- hash: 125476555952347040
243
+ hash: -1258509401476034243
246
244
  segments:
247
245
  - 0
248
246
  version: "0"
@@ -251,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
249
  requirements:
252
250
  - - ">="
253
251
  - !ruby/object:Gem::Version
254
- hash: 125476555952347040
252
+ hash: -1258509401476034243
255
253
  segments:
256
254
  - 0
257
255
  version: "0"
@@ -263,13 +261,11 @@ signing_key:
263
261
  specification_version: 3
264
262
  summary: The mother of all carbon models
265
263
  test_files:
266
- - spec/emitter/meta_spec.rb
267
264
  - spec/emitter_spec.rb
268
265
  - spec/fixtures/biplane/lib/biplane.rb
269
266
  - spec/fixtures/biplane/lib/biplane/carbon_model.rb
270
267
  - spec/fixtures/biplane/lib/biplane/characterization.rb
271
268
  - spec/fixtures/biplane/lib/biplane/data.rb
272
- - spec/fixtures/biplane/lib/biplane/fallback.rb
273
269
  - spec/fixtures/biplane/lib/biplane/relationships.rb
274
270
  - spec/fixtures/biplane/lib/biplane/summarization.rb
275
271
  - spec/fixtures/dirigible/lib/dirigible.rb
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class Automobile; extend BrighterPlanet::Emitter::Meta; end
4
- class Flight; extend BrighterPlanet::Emitter::Meta; end
5
-
6
- describe BrighterPlanet::Emitter::Meta do
7
- describe '.beta?' do
8
- it 'should return true for an emitter that is in beta' do
9
- BrighterPlanet::Emitter::BETA_LIST = ['flight']
10
- Flight.should be_beta
11
- end
12
- it 'should return false for an emitter that is not in beta' do
13
- Automobile.should_not be_beta
14
- end
15
- end
16
- end
17
-
@@ -1,7 +0,0 @@
1
- module BrighterPlanet
2
- module Biplane
3
- module Fallback
4
- end
5
- end
6
- end
7
-