Class: Bahn::RoutePart

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#end_timeObject

Returns the value of attribute end_time.



5
6
7
# File 'lib/bahn/bahn_routepart.rb', line 5

def end_time
  @end_time
end

#priceObject

Returns the value of attribute price.



5
6
7
# File 'lib/bahn/bahn_routepart.rb', line 5

def price
  @price
end

#startObject

Returns the value of attribute start.



5
6
7
# File 'lib/bahn/bahn_routepart.rb', line 5

def start
  @start
end

#start_timeObject

Returns the value of attribute start_time.



5
6
7
# File 'lib/bahn/bahn_routepart.rb', line 5

def start_time
  @start_time
end

#targetObject

Returns the value of attribute target.



5
6
7
# File 'lib/bahn/bahn_routepart.rb', line 5

def target
  @target
end

#typeObject

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_sObject

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