rail_trip 0.0.13 → 0.0.14

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.
@@ -0,0 +1,9 @@
1
+ module BrighterPlanet
2
+ module RailTrip
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 RailTrip
3
+ module Relationships
4
+ def self.included(target)
5
+ target.belongs_to :rail_class
6
+ end
7
+ end
8
+ end
9
+ end
@@ -20,7 +20,7 @@ module BrighterPlanet
20
20
  # This `summarize` block encapsulates the summarization strategy, including
21
21
  # terminology and inflection preference.
22
22
  base.summarize do |has|
23
- has.adjective lambda { |rail_trip| "#{rail_trip.distance_in_miles.adaptive_round(1)}-mile" }, :if => :distance
23
+ has.adjective lambda { |rail_trip| "#{rail_trip.distance.convert(:kilometres, :miles).round(1)}-mile" }, :if => :distance
24
24
  has.adjective lambda { |rail_trip| "#{rail_trip.duration}-hour" }, :if => :duration
25
25
  has.identity 'rail trip'
26
26
  has.verb :take
data/lib/rail_trip.rb CHANGED
@@ -3,15 +3,5 @@ require 'emitter'
3
3
  module BrighterPlanet
4
4
  module RailTrip
5
5
  extend BrighterPlanet::Emitter
6
-
7
- def self.rail_trip_model
8
- if Object.const_defined? 'RailTrip'
9
- ::RailTrip
10
- elsif Object.const_defined? 'RailTripRecord'
11
- RailTripRecord
12
- else
13
- raise 'There is no rail_trip model'
14
- end
15
- end
16
6
  end
17
7
  end
@@ -3,7 +3,4 @@ require 'rail_trip'
3
3
  class RailTripRecord < ActiveRecord::Base
4
4
  include Sniff::Emitter
5
5
  include BrighterPlanet::RailTrip
6
- belongs_to :rail_class
7
-
8
- conversion_accessor :distance, :external => :miles, :internal => :kilometres
9
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rail_trip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 13
10
- version: 0.0.13
9
+ - 14
10
+ version: 0.0.14
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
@@ -171,6 +171,8 @@ files:
171
171
  - lib/rail_trip/carbon_model.rb
172
172
  - lib/rail_trip/characterization.rb
173
173
  - lib/rail_trip/data.rb
174
+ - lib/rail_trip/fallback.rb
175
+ - lib/rail_trip/relationships.rb
174
176
  - lib/rail_trip/summarization.rb
175
177
  - lib/test_support/rail_trip_record.rb
176
178
  - features/support/env.rb