Class: Ellington::Conductor

Inherits:
Object
  • Object
show all
Defined in:
lib/ellington/conductor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ Conductor

Returns a new instance of Conductor.



8
9
10
# File 'lib/ellington/conductor.rb', line 8

def initialize(route)
  @route = route
end

Instance Attribute Details

#routeObject (readonly)

Returns the value of attribute route.



6
7
8
# File 'lib/ellington/conductor.rb', line 6

def route
  @route
end

Instance Method Details

#conduct(passenger) ⇒ Object



18
19
20
21
22
# File 'lib/ellington/conductor.rb', line 18

def conduct(passenger)
  passenger = route.create_passenger(passenger) unless passenger.is_a?(Passenger)
  return unless verify(passenger)
  route.lines.first.board passenger
end

#verify(passenger) ⇒ Object

override this method in a subclass to perform actual passenger verification



14
15
16
# File 'lib/ellington/conductor.rb', line 14

def verify(passenger)
  true
end