Class: Ellington::Attendant

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(station) ⇒ Attendant

Returns a new instance of Attendant.



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

def initialize(station)
  @station = station
  @passenger_transitions = []
end

Instance Attribute Details

#passenger_transitionsObject (readonly)

Returns the value of attribute passenger_transitions.



4
5
6
# File 'lib/ellington/attendant.rb', line 4

def passenger_transitions
  @passenger_transitions
end

#stationObject (readonly)

Returns the value of attribute station.



4
5
6
# File 'lib/ellington/attendant.rb', line 4

def station
  @station
end

Instance Method Details

#approve?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/ellington/attendant.rb', line 15

def approve?
  passenger_transitions.length == 1 && 
    station.states.include?(passenger_transitions.first.new_state)
end

#update(transition_info) ⇒ Object



11
12
13
# File 'lib/ellington/attendant.rb', line 11

def update(transition_info)
  passenger_transitions << transition_info
end