Class: Energy::AutomobileTrip
- Defined in:
- lib/energy/automobile_trip.rb
Instance Attribute Summary collapse
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#make ⇒ Object
Returns the value of attribute make.
-
#model ⇒ Object
Returns the value of attribute model.
Class Method Summary collapse
-
.fuel_use(attrs = {}) ⇒ Object
Estimate the fuel used by an automobile trip given any of the following optional characteristics: *
make
- “nissan” *model
- “altima” *distance
- 500 (kilometres) See carbon.brighterplanet.com/models/rail_trip for more details.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ AutomobileTrip
constructor
:nodoc:.
Constructor Details
#initialize(attrs = {}) ⇒ AutomobileTrip
:nodoc:
13 14 15 16 17 18 |
# File 'lib/energy/automobile_trip.rb', line 13 def initialize(attrs = {}) # :nodoc: attrs = attrs.symbolize_keys @make = attrs[:make] @model = attrs[:model] @distance = attrs[:distance] end |
Instance Attribute Details
#distance ⇒ Object
Returns the value of attribute distance.
5 6 7 |
# File 'lib/energy/automobile_trip.rb', line 5 def distance @distance end |
#make ⇒ Object
Returns the value of attribute make.
3 4 5 |
# File 'lib/energy/automobile_trip.rb', line 3 def make @make end |
#model ⇒ Object
Returns the value of attribute model.
4 5 6 |
# File 'lib/energy/automobile_trip.rb', line 4 def model @model end |
Class Method Details
.fuel_use(attrs = {}) ⇒ Object
Estimate the fuel used by an automobile trip given any of the following optional characteristics:
-
make
- “nissan” -
model
- “altima” -
distance
- 500 (kilometres)
See carbon.brighterplanet.com/models/rail_trip for more details
26 27 28 |
# File 'lib/energy/automobile_trip.rb', line 26 def fuel_use(attrs = {}) estimate :fuel_use, attrs end |