module TokyoMetro::Modules::Common::Info::StationFacility::BarrierFree::Escalator::ServiceDetail::Direction

Public Instance Methods

attribute() click to toggle source
# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 62
def attribute
  if both?
    :both
  elsif only_up?
    :up
  else
    :down
  end
end
both() click to toggle source

両方向にエスカレータが存在するか否か @return [Boolean]

# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 15
def both
  up and down
end
only_down() click to toggle source
# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 9
def only_down
  down and !( up )
end
only_up() click to toggle source

@!group 方向の判定

# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 5
def only_up
  up and !( down )
end
to_a() click to toggle source
# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 72
def to_a
  [ self.up? , self.down? ]
end
to_h() click to toggle source
# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 76
def to_h
  { up: self.up? , down: self.down? }
end
to_s() click to toggle source

方向の情報を文字列に変換するメソッド @return [String]

# File lib/tokyo_metro/modules/common/info/station_facility/barrier_free/escalator/service_detail/direction.rb, line 50
def to_s
  if both?
    "上り・下り"
  elsif only_up?
    "上り"
  elsif only_down?
    "下り"
  else
    raise "Error"
  end
end