Class: Ellington::Attendant
- Inherits:
-
Object
- Object
- Ellington::Attendant
- Defined in:
- lib/ellington/attendant.rb
Instance Attribute Summary collapse
-
#passenger_transitions ⇒ Object
readonly
Returns the value of attribute passenger_transitions.
-
#station ⇒ Object
readonly
Returns the value of attribute station.
Instance Method Summary collapse
- #approve? ⇒ Boolean
-
#initialize(station) ⇒ Attendant
constructor
A new instance of Attendant.
- #update(transition_info) ⇒ Object
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_transitions ⇒ Object (readonly)
Returns the value of attribute passenger_transitions.
4 5 6 |
# File 'lib/ellington/attendant.rb', line 4 def passenger_transitions @passenger_transitions end |
#station ⇒ Object (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
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 |