Class: TokyoMetro::App::Renderer::StationFacility::Platform

Inherits:
Factory::Decorate::MetaClass show all
Defined in:
lib/tokyo_metro/app/renderer/station_facility/platform.rb

Defined Under Namespace

Modules: Info Classes: List

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, station_facility_info) ⇒ Platform

Returns a new instance of Platform.



3
4
5
6
7
8
# File 'lib/tokyo_metro/app/renderer/station_facility/platform.rb', line 3

def initialize( request , station_facility_info )
  super( request )
  @station_facility_info = station_facility_info
  @platform_infos_grouped_by_railway_line = platform_infos_grouped_by_railway_line
  @type_of_platform_infos = type_of_platform_infos
end

Class Method Details

.make_list(request, station_facility_info) ⇒ Object



60
61
62
# File 'lib/tokyo_metro/app/renderer/station_facility/platform.rb', line 60

def self.make_list( request , station_facility_info )
  self.new( request , station_facility_info ).to_a
end

Instance Method Details

#to_aObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/tokyo_metro/app/renderer/station_facility/platform.rb', line 10

def to_a
  ary = ::Array.new
  case @type_of_platform_infos
  when :between_wakoshi_and_hikawadai
    # puts @type_of_platform_infos
    ary << ::TokyoMetro::App::Renderer::StationFacility::Platform::Info::BetweenWakoshiAndHikawadai::Whole.new(
      request ,
      @platform_infos_grouped_by_railway_line.values.first ,
      ::RailwayLine.where( id: railway_line_ids_of_platform_infos )
    )

  when :kotake_mukaihara
    # puts @type_of_platform_infos
    ary << ::TokyoMetro::App::Renderer::StationFacility::Platform::Info::KotakeMukaihara::Whole.new(
      request ,
      @platform_infos_grouped_by_railway_line.values.first ,
      ::RailwayLine.where( id: railway_line_ids_of_platform_infos )
    )

  when :meguro_and_shirokanedai
    # puts @type_of_platform_infos
    ary << ::TokyoMetro::App::Renderer::StationFacility::Platform::Info::MeguroAndShirokanedai::Whole.new(
      request ,
      @platform_infos_grouped_by_railway_line.values.first ,
      ::RailwayLine.where( same_as: [ "odpt.Railway:TokyoMetro.Namboku" , "odpt.Railway:Toei.Mita" ] ).order( :id )
    )

  when :shirokane_takanawa
    # puts @type_of_platform_infos
    ary << ::TokyoMetro::App::Renderer::StationFacility::Platform::Info::ShirokaneTakanawa::Whole.new(
      request ,
      @platform_infos_grouped_by_railway_line.values.first ,
      ::RailwayLine.where( same_as: [ "odpt.Railway:TokyoMetro.Namboku" , "odpt.Railway:Toei.Mita" ] ).order( :id )
    )

  when :normal
    # puts @type_of_platform_infos
    @platform_infos_grouped_by_railway_line.each do | railway_line_id , platform_infos |
      ary << ::TokyoMetro::App::Renderer::StationFacility::Platform::Info::Normal::Whole.new(
        request ,
        platform_infos ,
        ::RailwayLine.find( railway_line_id )
      )
    end

  end

  ::TokyoMetro::App::Renderer::StationFacility::Platform::List.new( @resuest , ary )
end