Class: Ellington::LineInfo
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ellington::LineInfo
- Defined in:
- lib/ellington/line_info.rb
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#station_info ⇒ Object
readonly
Returns the value of attribute station_info.
Instance Method Summary collapse
-
#initialize(line, station_info) ⇒ LineInfo
constructor
A new instance of LineInfo.
- #line_completed_message ⇒ Object
- #passenger_message ⇒ Object
- #station_completed_message ⇒ Object
- #station_full_name ⇒ Object
Constructor Details
#initialize(line, station_info) ⇒ LineInfo
Returns a new instance of LineInfo.
7 8 9 10 11 |
# File 'lib/ellington/line_info.rb', line 7 def initialize(line, station_info) @line = line @station_info = station_info super station_info end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/ellington/line_info.rb', line 5 def line @line end |
#station_info ⇒ Object (readonly)
Returns the value of attribute station_info.
5 6 7 |
# File 'lib/ellington/line_info.rb', line 5 def station_info @station_info end |
Instance Method Details
#line_completed_message ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/ellington/line_info.rb', line 26 def = [] << "[LINE COMPLETED]" << "[#{line.state(passenger)}]" << "[#{line.name}]" .concat .join " " end |
#passenger_message ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/ellington/line_info.rb', line 35 def line.route.passenger_attrs_to_log.reduce([]) do |memo, attr| value = passenger.send(attr) rescue nil memo << "[#{attr}:#{value}]" unless value.nil? memo end end |
#station_completed_message ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/ellington/line_info.rb', line 17 def = [] << "[STATION COMPLETED]" << "[#{station.state(passenger)}]" << "[#{station_full_name}]" .concat .join " " end |
#station_full_name ⇒ Object
13 14 15 |
# File 'lib/ellington/line_info.rb', line 13 def station_full_name @station_full_name ||= "#{line.route.name} #{line.class.name} #{station.class.name}" end |