bus_trip 0.0.14 → 0.0.15
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/lib/bus_trip.rb +0 -10
- data/lib/bus_trip/fallback.rb +9 -0
- data/lib/bus_trip/relationships.rb +9 -0
- data/lib/bus_trip/summarization.rb +1 -1
- data/lib/test_support/bus_trip_record.rb +0 -10
- metadata +6 -4
data/lib/bus_trip.rb
CHANGED
@@ -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
|
@@ -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.
|
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:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
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
|