Class: TokyoMetro::App::Renderer::StationFacility::Platform::Info::MetaClass::Whole

Inherits:
Factory::Decorate::MetaClass show all
Includes:
Common
Defined in:
lib/tokyo_metro/app/renderer/station_facility/platform/info/meta_class/whole.rb

Instance Attribute Summary collapse

方面別の情報 collapse

Instance Method Summary collapse

Methods included from Common

#barrier_free_facility_infos, #car_composition_types, #has_barrier_free_facility_infos?, #has_one_car_composition_type?, #has_railway_direction_infos?, #has_surrounding_area_infos?, #has_transfer_infos?, #max_car_composition, #railway_line_css_class_name, #railway_line_name_en, #railway_line_name_ja, #surrounding_area_infos, #tab_name, #transfer_infos

Constructor Details

#initialize(request, platform_infos, railway_lines) ⇒ Whole

Returns a new instance of Whole.



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

def initialize( request , platform_infos , railway_lines )
  super( request )
  @platform_infos = platform_infos
  set_railway_line( [ railway_lines ].flatten )
end

Instance Attribute Details

#platform_infosObject (readonly)

Returns the value of attribute platform_infos.



9
10
11
# File 'lib/tokyo_metro/app/renderer/station_facility/platform/info/meta_class/whole.rb', line 9

def platform_infos
  @platform_infos
end

Instance Method Details

#grouped_by_railway_directionObject



44
45
46
47
48
49
50
51
52
# File 'lib/tokyo_metro/app/renderer/station_facility/platform/info/meta_class/whole.rb', line 44

def grouped_by_railway_direction
  if has_railway_direction_infos?
    @platform_infos.group_by( &:railway_direction_id ).map { | railway_direction_id , infos |
      ( self.class.upper_namespace )::EachDirection.new( @request , infos , railway_line_info , ::RailwayDirection.find( railway_direction_id ) )
    }
  else
    [ ( self.class.upper_namespace )::EachDirection.new( @request , @platform_infos , railway_line_info , nil ) ]
  end
end

#render_contentObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tokyo_metro/app/renderer/station_facility/platform/info/meta_class/whole.rb', line 28

def render_content
  h.render inline: <<-HAML , type: :haml , locals: h_locals
%li{ id: info.tab_name , name: info.tab_name , class: :platform_info_tab_content }
%div{ class: info.railway_line_css_class_name }
  %div{ class: :title_of_railway_line }
    %h3{ class: :text_ja }<
      = info.railway_line_name_ja
    %h4{ class: :text_en }<
      = info.railway_line_name_en
- info.grouped_by_railway_direction.each do | infos_of_each_direction |
  = infos_of_each_direction.render
  HAML
end

#render_railway_line_text_nameObject



18
19
20
21
22
23
24
25
26
# File 'lib/tokyo_metro/app/renderer/station_facility/platform/info/meta_class/whole.rb', line 18

def render_railway_line_text_name
  h.render inline: <<-HAML , type: :haml , locals: { this: self }
%div{ class: [ :text , :clearfix ] }<
%div{ class: :text_ja }<
  = this.railway_line_name_ja
%div{ class: :text_en }<
  = this.railway_line_name_en
  HAML
end

#render_tabObject

乗車位置情報のタブを作成



14
15
16
# File 'lib/tokyo_metro/app/renderer/station_facility/platform/info/meta_class/whole.rb', line 14

def render_tab
  raise "Error: The method \'#{ __method__ }\' is not defined yet in this class."
end