class Vehicle

Attributes

auto_shop[RW]
callbacks[RW]
force_idle[RW]
insurance_premium[RW]
saved[RW]
seatbelt_on[RW]
time_elapsed[RW]

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method
# File test/functional/state_machine_test.rb, line 45
def initialize(attributes = {})
  attributes = {
    :auto_shop => AutoShop.new,
    :seatbelt_on => false,
    :insurance_premium => 50,
    :force_idle => false,
    :callbacks => [],
    :saved => false
  }.merge(attributes)
  
  attributes.each {|attr, value| send("#{attr}=", value)}
  super()
end

Public Instance Methods

decibels() click to toggle source
# File test/functional/state_machine_test.rb, line 144
def decibels
  0.0
end
fix() click to toggle source

Fixes the vehicle; it will no longer be in the auto shop

# File test/functional/state_machine_test.rb, line 140
def fix
  auto_shop.fix_vehicle
end
new_record?() click to toggle source
# File test/functional/state_machine_test.rb, line 126
def new_record?
  @saved == false
end
park() click to toggle source
Calls superclass method
# File test/functional/state_machine_test.rb, line 130
def park
  super
end
save() click to toggle source
Calls superclass method ModelBase#save
# File test/functional/state_machine_test.rb, line 122
def save
  super
end
tow() click to toggle source

Tows the vehicle to the auto shop

# File test/functional/state_machine_test.rb, line 135
def tow
  auto_shop.tow_vehicle
end