Class: TokyoMetro::App::Renderer::TravelTimeInfo::MetaClass::Row::Section

Inherits:
Factory::Decorate::MetaClass show all
Defined in:
lib/tokyo_metro/app/renderer/travel_time_info/meta_class/row/section.rb

Instance Method Summary collapse

Constructor Details

#initialize(request, section_info, necessary_time, left_columns, columns_next_to_railway_line, right_columns, additional_info_left_between_stations, additional_info_next_to_railway_between_stations, additional_info_right_between_stations) ⇒ Section

Returns a new instance of Section.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tokyo_metro/app/renderer/travel_time_info/meta_class/row/section.rb', line 3

def initialize(
  request ,  , necessary_time ,
  left_columns , columns_next_to_railway_line , right_columns ,
  additional_info_left_between_stations , additional_info_next_to_railway_between_stations , additional_info_right_between_stations
)
  super( request )
  @section_info = 
  @necessary_time = necessary_time

  @left_columns = left_columns
  @columns_next_to_railway_line = columns_next_to_railway_line
  @right_columns = right_columns

  @additional_info_left_between_stations = additional_info_left_between_stations
  @additional_info_next_to_railway_between_stations = additional_info_next_to_railway_between_stations
  @additional_info_right_between_stations = additional_info_right_between_stations
end

Instance Method Details

#renderObject



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
# File 'lib/tokyo_metro/app/renderer/travel_time_info/meta_class/row/section.rb', line 21

def render
  h.render inline: <<-HAML , type: :haml , locals: h_locals
%tr{ class: :between_stations }
- if additional_info_left_between_stations.present? and additional_info_left_between_stations.has_procedure_of?( section_info )
  = additional_info_left_between_stations.render( section_info )
- elsif left_columns > 1
  %td{ colspan: left_columns }<
    = " "
- else
  %td<
    = " "

- if additional_info_next_to_railway_between_stations.present? and additional_info_next_to_railway_between_stations.has_procedure_of?( section_info )
  = additional_info_next_to_railway_between_stations.render( section_info )
- elsif columns_next_to_railway_line == 1
  %td<
    = " "
- elsif columns_next_to_railway_line > 1
  %td{ colspan: columns_next_to_railway_line }<
    = " "

%td{ class: :travel_time }<
  = "(" + necessary_time.to_s + ")"

- if additional_info_right_between_stations.present? and additional_info_right_between_stations.has_procedure_of?( section_info )
  = additional_info_right_between_stations.render( section_info )
- elsif right_columns > 1
  %td{ colspan: right_columns }<
    = " "
- else
  %td<
    = " "
  HAML
end