class TokyoMetro::Api::StationTimetable::Info::TrainTime::Info::Note::PlatformNumber

出発ホームの情報を扱うクラス

Attributes

number[R]

@return [Integer] 出発ホーム

Public Class Methods

new( number ) click to toggle source

Constructor @param number [Integer] 出発ホーム

# File lib/tokyo_metro/api/station_timetable/info/train_time/info/note/platform_number.rb, line 6
def initialize( number )
  @number = number
end
set_constant() click to toggle source

定数 ARRAY を定義するメソッド @return [nil]

# File lib/tokyo_metro/api/station_timetable/info/train_time/info/note/platform_number.rb, line 28
def self.set_constant
  h = Hash.new
  ( 1..10 ).each do |i|
    h[i] = self.new( i )
  end
  self.const_set( :LIST , h )
  return nil
end
set_from_string( i ) click to toggle source

出発ホームからインスタンスを取得するメソッド @param i [Integer] 出発ホーム @return [PlatformNumber]

# File lib/tokyo_metro/api/station_timetable/info/train_time/info/note/platform_number.rb, line 40
def self.set_from_string( i )
  LIST[i]
end

Public Instance Methods

<=>( other_instance ) click to toggle source

他のインスタンスとの比較に使用するメソッド @param other_instance [PlatformNumber] 比較対象のインスタンス @return [Integer]

# File lib/tokyo_metro/api/station_timetable/info/train_time/info/note/platform_number.rb, line 22
def <=>( other_instance )
  @number <=> other_instance.number
end
to_s() click to toggle source

自身の情報を文字列に変換して返すメソッド @return [String]

# File lib/tokyo_metro/api/station_timetable/info/train_time/info/note/platform_number.rb, line 15
def to_s
  "#{@number}番線発"
end