automobile 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/automobile.gemspec +5 -2
- data/lib/automobile.rb +8 -1
- metadata +17 -5
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/brighterplanet/automobile"
|
12
12
|
gem.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling"]
|
13
13
|
gem.add_dependency 'leap'
|
14
|
+
gem.add_dependency 'conversions'
|
14
15
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
15
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/automobile.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{automobile}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling"]
|
12
|
-
s.date = %q{2010-06
|
12
|
+
s.date = %q{2010-07-06}
|
13
13
|
s.description = %q{A software model in Ruby for the greenhouse gas emissions of an automobile}
|
14
14
|
s.email = %q{andy@rossmeissl.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -44,13 +44,16 @@ Gem::Specification.new do |s|
|
|
44
44
|
|
45
45
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
46
46
|
s.add_runtime_dependency(%q<leap>, [">= 0"])
|
47
|
+
s.add_runtime_dependency(%q<conversions>, [">= 0"])
|
47
48
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
48
49
|
else
|
49
50
|
s.add_dependency(%q<leap>, [">= 0"])
|
51
|
+
s.add_dependency(%q<conversions>, [">= 0"])
|
50
52
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
51
53
|
end
|
52
54
|
else
|
53
55
|
s.add_dependency(%q<leap>, [">= 0"])
|
56
|
+
s.add_dependency(%q<conversions>, [">= 0"])
|
54
57
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
55
58
|
end
|
56
59
|
end
|
data/lib/automobile.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'conversions'
|
2
|
+
|
1
3
|
module BrighterPlanet
|
2
4
|
module Automobile
|
3
5
|
def self.included(base)
|
@@ -155,7 +157,7 @@ module BrighterPlanet
|
|
155
157
|
|
156
158
|
committee :speed do # returns kilometres per hour
|
157
159
|
quorum 'from urbanity', :needs => :urbanity do |characteristics|
|
158
|
-
1 / (characteristics[:urbanity] / ::Automobile::
|
160
|
+
1 / (characteristics[:urbanity] / ::BrighterPlanet::Automobile::SPEEDS[:city] + (1 - characteristics[:urbanity]) / ::BrighterPlanet::Automobile::SPEEDS[:highway])
|
159
161
|
end
|
160
162
|
end
|
161
163
|
|
@@ -183,6 +185,7 @@ module BrighterPlanet
|
|
183
185
|
|
184
186
|
committee :acquisition do
|
185
187
|
quorum 'from model year or year', :appreciates => [:model_year, :year] do |characteristics|
|
188
|
+
puts characteristics.inspect
|
186
189
|
!characteristics.empty? && Date.new((characteristics[:model_year].andand.year || characteristics[:year]).to_i - 1, 1, 1)
|
187
190
|
end
|
188
191
|
quorum 'from retirement', :appreciates => :retirement do |characteristics, timeframe|
|
@@ -198,5 +201,9 @@ module BrighterPlanet
|
|
198
201
|
|
199
202
|
end
|
200
203
|
end
|
204
|
+
SPEEDS = {
|
205
|
+
:highway => 57.1.miles.to(:kilometres), # https://brighterplanet.sifterapp.com/projects/30/issues/428
|
206
|
+
:city => 19.9.miles.to(:kilometres) # https://brighterplanet.sifterapp.com/projects/30/issues/428
|
207
|
+
}
|
201
208
|
end
|
202
209
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andy Rossmeissl
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-06
|
20
|
+
date: 2010-07-06 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: conversions
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
@@ -42,8 +42,20 @@ dependencies:
|
|
42
42
|
segments:
|
43
43
|
- 0
|
44
44
|
version: "0"
|
45
|
-
type: :
|
45
|
+
type: :runtime
|
46
46
|
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: thoughtbot-shoulda
|
49
|
+
prerelease: false
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id003
|
47
59
|
description: A software model in Ruby for the greenhouse gas emissions of an automobile
|
48
60
|
email: andy@rossmeissl.net
|
49
61
|
executables: []
|