Class: Bahn::RoutePart
- Inherits:
-
Object
- Object
- Bahn::RoutePart
- Defined in:
- lib/bahn/bahn_routepart.rb
Overview
Example: “Am 2013-02-01 von 17:33 bis 17:47 : Heerdter Sandberg U, Düsseldorf nach Düsseldorf Hauptbahnhof via U 7”
Instance Attribute Summary collapse
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#price ⇒ Object
Returns the value of attribute price.
-
#start ⇒ Object
Returns the value of attribute start.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#target ⇒ Object
Returns the value of attribute target.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#to_s ⇒ Object
Return a nicely formatted route Raises errors if not everything is set properly.
Instance Attribute Details
#end_time ⇒ Object
Returns the value of attribute end_time.
5 6 7 |
# File 'lib/bahn/bahn_routepart.rb', line 5 def end_time @end_time end |
#price ⇒ Object
Returns the value of attribute price.
5 6 7 |
# File 'lib/bahn/bahn_routepart.rb', line 5 def price @price end |
#start ⇒ Object
Returns the value of attribute start.
5 6 7 |
# File 'lib/bahn/bahn_routepart.rb', line 5 def start @start end |
#start_time ⇒ Object
Returns the value of attribute start_time.
5 6 7 |
# File 'lib/bahn/bahn_routepart.rb', line 5 def start_time @start_time end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/bahn/bahn_routepart.rb', line 5 def target @target end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/bahn/bahn_routepart.rb', line 5 def type @type end |
Instance Method Details
#to_s ⇒ Object
Return a nicely formatted route Raises errors if not everything is set properly
9 10 11 |
# File 'lib/bahn/bahn_routepart.rb', line 9 def to_s "Am #{start_time.to_date} von #{start_time.hour}:#{start_time.min} bis #{end_time.to_date.to_s + ' ' if end_time.to_date != start_time.to_date}#{end_time.hour}:#{end_time.min} : #{start} nach #{target} via #{type}" end |