bus_trip 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,15 +3,5 @@ require 'emitter'
3
3
  module BrighterPlanet
4
4
  module BusTrip
5
5
  extend BrighterPlanet::Emitter
6
-
7
- def self.bus_trip_model
8
- if Object.const_defined? 'BusTrip'
9
- ::BusTrip
10
- elsif Object.const_defined? 'BusTripRecord'
11
- BusTripRecord
12
- else
13
- raise 'There is no bus_trip model'
14
- end
15
- end
16
6
  end
17
7
  end
@@ -0,0 +1,9 @@
1
+ module BrighterPlanet
2
+ module BusTrip
3
+ module Fallback
4
+ def self.included(base)
5
+ base.falls_back_on
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module BrighterPlanet
2
+ module BusTrip
3
+ module Relationships
4
+ def self.included(target)
5
+ target.belongs_to :bus_class
6
+ end
7
+ end
8
+ end
9
+ end
@@ -3,7 +3,7 @@ module BrighterPlanet
3
3
  module Summarization
4
4
  def self.included(base)
5
5
  base.summarize do |has|
6
- has.adjective lambda { |bus_trip| "#{bus_trip.distance_estimate_in_miles.adaptive_round(1)}-mile" }, :if => :distance_estimate
6
+ has.adjective lambda { |bus_trip| "#{bus_trip.distance_estimate.convert(:kilometres, :miles).round(1)}-mile" }, :if => :distance_estimate
7
7
  has.adjective lambda { |bus_trip| "#{bus_trip.duration}-minute" }, :if => :duration
8
8
  has.identity 'bus trip'
9
9
  has.verb :take
@@ -3,14 +3,4 @@ require 'bus_trip'
3
3
  class BusTripRecord < ActiveRecord::Base
4
4
  include Sniff::Emitter
5
5
  include BrighterPlanet::BusTrip
6
- belongs_to :bus_class
7
-
8
- conversion_accessor :distance_estimate, :external => :miles, :internal => :kilometres
9
-
10
- falls_back_on
11
-
12
- def emission_date
13
- created_at.to_date #FIXME we should add a date characteristic for this emitter
14
- end
15
6
  end
16
-
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bus_trip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 14
10
- version: 0.0.14
9
+ - 15
10
+ version: 0.0.15
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-12-02 00:00:00 -05:00
22
+ date: 2010-12-07 00:00:00 -06:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -170,6 +170,8 @@ files:
170
170
  - lib/bus_trip/carbon_model.rb
171
171
  - lib/bus_trip/characterization.rb
172
172
  - lib/bus_trip/data.rb
173
+ - lib/bus_trip/fallback.rb
174
+ - lib/bus_trip/relationships.rb
173
175
  - lib/bus_trip/summarization.rb
174
176
  - lib/test_support/bus_trip_record.rb
175
177
  - features/support/env.rb