class TokyoMetro::Api::PassengerSurvey::Info

個別の駅の乗降者数を扱うクラス

Attributes

operator[R]

運行会社 @return [String]

passenger_journeys[R]

駅の1日あたりの平均乗降人員数 @return [Integer]

same_as[R]

固有識別子 @return [String] @note 命名ルールは「odpt.PassengerSurvey:TokyoMetro.駅名.調査年」 @example

odpt:PassengerSurvey:TokyoMetro.Tokyo.2013
survey_year[R]

調査年度 @return [Integer]

Public Class Methods

new( id_urn , same_as , operator , survey_year , passenger_journeys ) click to toggle source

Constructor

# File lib/tokyo_metro/api/passenger_survey/info.rb, line 10
def initialize( id_urn , same_as , operator , survey_year , passenger_journeys )
  @id_urn = id_urn
  @same_as = same_as
  @operator = operator
  @survey_year = survey_year
  @passenger_journeys = passenger_journeys
end

Public Instance Methods

to_h() click to toggle source

インスタンスの情報をハッシュにして返すメソッド @return [Hash]

# File lib/tokyo_metro/api/passenger_survey/info.rb, line 39
def to_h
  h = Hash.new

  set_data_to_hash( h , "\@id" , @id_urn )
  set_data_to_hash( h , "owl:sameAs" , @same_as )
  set_data_to_hash( h , "odpt:operator" , @operator )
  set_data_to_hash( h , "odpt:surveyYear" , @survey_year )
  set_data_to_hash( h , "odpt:passengerJourneys" , @passenger_journeys )

  h
end
to_s( indent = 0 ) click to toggle source

インスタンスの情報を文字列にして返すメソッド @param indent [Integer (>0)] インデントの幅 @return [String]

# File lib/tokyo_metro/api/passenger_survey/info.rb, line 54
def to_s( indent = 0 )
  str_ary = ::Array.new
  str_ary << "\[#{self.class.rdf_type}\] #{@same_as}"
  str_ary << ""
  h = self.to_h
  h[ "odpt:passengerJourneys" ] = h[ "odpt:passengerJourneys" ].to_currency
  h.each do | key , value |
    str_ary << ( " " * 2 + key.ljust(32) + value.to_s )
  end
  str_ary.map { | str | " " * indent + str }.join( "\n" )
end
Also aliased as: to_strf
to_strf( indent = 0 )
Alias for: to_s