Module: TokyoMetro::Modules::Common::Info::StationFacility::BarrierFree::ToiletAssistant

Included in:
Api::StationFacility::Info::BarrierFree::Facility::Toilet::Assistant
Defined in:
lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb', line 35

def method_missing( method_name , *args )
  if args.empty? and /(?:baby|babies|ostomate)/ === method_name.to_s
    valid_method_name = method_missing__valid_method( method_name )
    if valid_method_name.present?
      send( valid_method_name )
    end
  end

  super
end

Instance Method Details

#facility_for_babyBoolean

幼児用の設備があるか否かを判定するメソッド

Returns:

  • (Boolean)


9
10
11
# File 'lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb', line 9

def facility_for_baby
  baby_chair or baby_changing_table
end

#facility_for_ostomateObject



3
4
5
# File 'lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb', line 3

def facility_for_ostomate
  ostomate
end

#to_aObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb', line 46

def to_a
  ary = ::Array.new
  if wheel_chair_accessible?
    ary << "車いす対応"
  end
  if has_baby_chair?
    ary << "乳幼児用いす"
  end
  if has_baby_changing_table?
    ary << "おむつ交換台"
  end
  if has_facility_for_ostomate?
    ary << "オストメイト対応設備"
  end
  ary
end

#to_hObject



67
68
69
70
71
72
73
# File 'lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb', line 67

def to_h
  h = ::Hash.new
  [ :wheel_chair_accessible , :baby_chair , :baby_changing_table , :ostomate ].each do | key_name |
    h[ key_name ] = self.send( key_name )
  end
  h
end

#to_sObject



63
64
65
# File 'lib/tokyo_metro/modules/common/info/station_facility/barrier_free/toilet_assistant.rb', line 63

def to_s
  to_a.join("")
end