Class: TokyoMetro::App::Renderer::FareTable::ToEachRailwayLine

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

Defined Under Namespace

Modules: StationInfos Classes: Rows

Instance Method Summary collapse

Constructor Details

#initialize(request, railway_line, station_infos_including_other_railway_lines, starting_station_info, fares, normal_fare_groups) ⇒ ToEachRailwayLine

Returns a new instance of ToEachRailwayLine.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tokyo_metro/app/renderer/fare_table/to_each_railway_line.rb', line 5

def initialize( request , railway_line , station_infos_including_other_railway_lines , starting_station_info , fares , normal_fare_groups )
  super( request )
  @railway_line = railway_line
  @station_infos_including_other_railway_lines = station_infos_including_other_railway_lines
  @starting_station_info = starting_station_info
  @fares = fares
  @normal_fare_groups = normal_fare_groups

  @station_infos_of_railway_line = set_station_infos_of_railway_line
  @id_of_starting_station_info = set_id_of_starting_station_info
end

Instance Method Details

#renderObject



17
18
19
20
21
22
23
# File 'lib/tokyo_metro/app/renderer/fare_table/to_each_railway_line.rb', line 17

def render
  if @id_of_starting_station_info.present?
    render_when_having_starting_station_info
  else
    render_when_not_having_starting_station_info
  end
end

#render_header_of_tableObject



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
59
60
61
62
63
64
# File 'lib/tokyo_metro/app/renderer/fare_table/to_each_railway_line.rb', line 25

def render_header_of_table
  h_locals_i = {
    request: request ,
    starting_station_info_decorated: @starting_station_info.decorate
  }
  h.render inline: <<-HAML , type: :haml , locals: h_locals_i
%tr{ class: :header }
%td{ rowspan: 3 , class: [ :station_name_top , :header_bottom ] }<
  - # 出発駅を表示
  %div{ class: [ :starting_station_info , :clearfix ] }
    = starting_station_info_decorated.render_station_code_image( all: true )
    %div{ class: :text }
      = starting_station_info_decorated.render_name_ja_and_en( with_subname: true , suffix_ja: "から" , prefix_en: "From " )
  %div{ class: :arrow }
    = ::TokyoMetro::App::Renderer::Icon.angle_double_down( request ).render
%td{ colspan: 4 , class: :normal_fare }<
  != "普通運賃"
  %span{ class: [ :small , :text_en ] }<
    = "Normal fare"
%tr{ class: [ :header , :fare_type ] }
%td{ colspan: 2 , class: :ic_card }<
  != "ICカード利用"
  %span{ class: [ :small , :text_en ] }<
    = "IC card"
%td{ colspan: 2 , class: :ticket }<
  != "切符"
  %span{ class: [ :small , :text_en ] }<
    = "Ticket"
%tr{ class: :header , class: :fares }
- [ :ic_card , :ticket ].each do | group |
  %td{ class: [ group , :adult , :header_bottom ] }<
    != "大人"
    %span{ class: [ :small , :text_en ] }<
      = "Adult"
  %td{ class: [ group , :child , :header_bottom ] }<
    != "小児"
    %span{ class: [ :small , :text_en ] }<
      = "Child"
  HAML
end