class TokyoMetro::Api::RailwayLine::Info::TravelTime::Info
各駅間の標準所要時間を扱うクラス
Attributes
from[R]
駅間の起点 <odpt:fromStation - odpt:Station> @return [String]
from_station[R]
駅間の起点 <odpt:fromStation - odpt:Station> @return [String]
necessary_time[R]
駅間の所要時間(分) <odpt:necessaryTime - xsd:integer> @return [Integer]
time[R]
駅間の所要時間(分) <odpt:necessaryTime - xsd:integer> @return [Integer]
to[R]
駅間の終点 <odpt:toStation - odpt:Station> @return [String]
to_station[R]
駅間の終点 <odpt:toStation - odpt:Station> @return [String]
Public Class Methods
factory_for_generating_from_hash()
click to toggle source
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 55 def self.factory_for_generating_from_hash factory_for_generating_travel_time_info_from_hash end
factory_for_seeding_this_class()
click to toggle source
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 59 def self.factory_for_seeding_this_class factory_for_seeding_travel_time_infos end
new( from_station , to_station , necessary_time )
click to toggle source
Constructor
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 5 def initialize( from_station , to_station , necessary_time ) @from_station = from_station @to_station = to_station @necessary_time = necessary_time end
Public Instance Methods
between?( station_a , station_b )
click to toggle source
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 51 def between?( station_a , station_b ) [ @from_station , @to_station ] == [ station_a , station_b ] or [ @from_station , @to_station ] == [ station_b , station_a ] end
to_a()
click to toggle source
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 39 def to_a [ @from_station , @to_station , @necessary_time ] end
to_h()
click to toggle source
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 43 def to_h h = Hash.new h[ "odpt:fromStation" ] = @from_station h[ "odpt:toStation" ] = @to_station h[ "odpt:necessaryTime" ] = @necessary_time h end
to_s( indent = 0 )
click to toggle source
インスタンスの情報を文字列にして返すメソッド @param indent [Integer (>=0)] インデントの幅 @return [String]
# File lib/tokyo_metro/api/railway_line/info/travel_time/info.rb, line 29 def to_s( indent = 0 ) str_ary = ::Array.new self.to_h.each do | key , value | str_ary << " " * indent + key.ljust(32) + value.to_s end str_ary.join( "\n" ) end
Also aliased as: to_strf