Class: TokyoMetro::App::Renderer::StationTimetable::Group::EachRailwayLine::EachRailwayDirection::EachOperationDay

Inherits:
Factory::Decorate::MetaClass
  • Object
show all
Defined in:
lib/tokyo_metro/app/renderer/station_timetable/group/each_railway_line/each_direction/each_operation_day.rb

Overview

個別の時刻表(路線・方面・運行日別)を作成するためのクラス

Defined Under Namespace

Classes: StationTrainTimes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, station_info, railway_line, railway_direction, operation_day, station_train_times) ⇒ EachOperationDay

Constructor

Parameters:

  • station_train_times_of_a_direction_and_an_operation_day (Array <TrainTime>)

    各列車の情報(路線・方面・運行日別)のリスト

  • railway_line (RailwayLine)

    路線のインスタンス

  • direction (RailwayDirection)

    方面のインスタンス

  • operation_day (OperationDay)

    運行日のインスタンス

  • station (Station)

    駅のインスタンス(駅に複数の路線が乗り入れている場合は、代表する路線のインスタンス)



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tokyo_metro/app/renderer/station_timetable/group/each_railway_line/each_direction/each_operation_day.rb', line 10

def initialize( request , station_info , railway_line , railway_direction , operation_day , station_train_times )
  super( request )
  @station_info = station_info
  @railway_line = railway_line
  @railway_direction = railway_direction
  @operation_day = operation_day

  set_valid_station_info

  @station_train_times = ::TokyoMetro::App::Renderer::StationTimetable::Group::EachRailwayLine::EachRailwayDirection::EachOperationDay::StationTrainTimes.new( station_train_times )
end

Instance Attribute Details

#station_train_timesObject (readonly)

Returns the value of attribute station_train_times.



22
23
24
# File 'lib/tokyo_metro/app/renderer/station_timetable/group/each_railway_line/each_direction/each_operation_day.rb', line 22

def station_train_times
  @station_train_times
end

Instance Method Details

#renderObject



24
25
26
27
28
29
30
# File 'lib/tokyo_metro/app/renderer/station_timetable/group/each_railway_line/each_direction/each_operation_day.rb', line 24

def render
  h.render inline: <<-HAML , type: :haml , locals: h_locals
%table{ class: [ :station_timetable , operation_day.decorate.css_class_name ] }
= this.render_header
= this.station_train_times.render_body
  HAML
end

#render_headerObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/tokyo_metro/app/renderer/station_timetable/group/each_railway_line/each_direction/each_operation_day.rb', line 32

def render_header
  h.render inline: <<-HAML , type: :haml , locals: h_locals
%thead{ class: railway_line.css_class_name }
%tr
  %td{ colspan: 2 , class: :top_header }
    = railway_line.decorate.render_in_station_timetable_header
    %div{ class: :main }
      = operation_day.decorate.render_in_station_timetable_header
      = railway_direction.decorate.render_in_station_timetable_header
      - if station_info.present?
        = station_info.decorate.render_in_station_timetable_header
= station_train_times.render_message_in_header
  HAML
end