Class: TokyoMetro::App::Renderer::TravelTimeInfo::MetaClass::ThroughOperation::EachType

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

Defined Under Namespace

Classes: RailwayLineAndTerminalStation

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ EachType

Returns a new instance of EachType.



3
4
5
# File 'lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation/each_type.rb', line 3

def initialize( request )
  super( request )
end

Instance Method Details

#renderObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation/each_type.rb', line 7

def render
  h.render inline: <<-HAML , type: :haml , locals: h_locals
%div{ class: :through_operation_info }
- if train_type.present?
  = train_type.decorate.render_name_box_in_travel_time_info
  %div{ class: :precise }
    = this.render_precise_infos
- else
  = this.render_precise_infos
  HAML
end

#render_precise_infosObject



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
# File 'lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation/each_type.rb', line 19

def render_precise_infos
  h.render inline: <<-HAML , type: :haml , locals: h_locals
- if from_station.present?
%p{ class: :from }<
  = "〈" + from_station.name_ja + "から〉"

- if directions.present? or via.present?
- if directions.present?
  %p{ class: :direction }<
    = directions.map( &:name_ja ).join( "、" ) + "方面"
- if via.present?
  %p{ class: :via }<
    :ruby
      ary = [ via ].flatten.map( &:name_ja_with_operator_name_precise_and_without_parentheses )
    = ary.join( "、" ) + "経由"

%div{ class: :main }<
- if railway_line_and_terminal_station_infos.length > 1
  - railway_line_and_terminal_station_infos.each.with_index(1) do | info , i |
    %p
      - if i == railway_line_and_terminal_station_infos.length
        = info.render( suffix: "まで直通運転" )
      - else
        = info.render( suffix: "、" )
- else
  = railway_line_and_terminal_station_infos.first.render( suffix: "まで直通運転" )

- if note.present?
%div{ class: :note }<
  = "(" + note.to_s + ")"
  HAML
end