class TokyoMetro::App::Renderer::TravelTimeInfo::MetaClass::ThroughOperation

Public Class Methods

new( request , left_columns , columns_next_to_railway_line , right_columns ) click to toggle source
Calls superclass method
# File lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation.rb, line 3
def initialize( request , left_columns , columns_next_to_railway_line , right_columns )
  super( request )
  @left_columns = left_columns
  @columns_next_to_railway_line = columns_next_to_railway_line
  @right_columns = right_columns
end

Public Instance Methods

render() click to toggle source
# File lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation.rb, line 12
  def render
    h.render inline: <<-HAML , type: :haml , locals: h_locals
%tr{ class: [ :through_operation_info_row , position ] }<

  - if left_columns > 1 and ary.present?
    %td{ class: :through_operation_infos , colspan: left_columns }<
      - if ary.length == 1
        = ary.first.render
      - else
        - ary.each do | through_operation_type |
          = through_operation_type.render

  - elsif ary.present?
    %td{ class: :through_operation_infos }<
      - if ary.length == 1
        = ary.first.render
      - else
        - ary.each do | through_operation_type |
          = through_operation_type.render

  - elsif left_columns > 1
    %td{ class: :through_operation_infos , colspan: left_columns }<
      = " "

  - if columns_next_to_railway_line == 1
    %td{ class: :through_operation_infos }<
      = " "
  - elsif columns_next_to_railway_line > 1
    %td{ class: :through_operation_infos , colspan: columns_next_to_railway_line }<
      = " "

  %td{ class: [ :railway_line_column , class_name ] }<

  - if right_columns > 1
    %td{ colspan: right_columns }<
      = " "
  - else
    %td<
      = " "
    HAML
  end

Private Instance Methods

__h_locals__()
Alias for: h_locals
ary() click to toggle source
# File lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation.rb, line 75
def ary
  if @content.present?
    [ @content ].flatten
  else
    nil
  end
end
h_locals() click to toggle source
# File lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation.rb, line 68
def h_locals
  h_locals_base.merge({
    class_name: @class_name ,
    ary: ary
  })
end
Also aliased as: __h_locals__
h_locals_base() click to toggle source
# File lib/tokyo_metro/app/renderer/travel_time_info/meta_class/through_operation.rb, line 58
def h_locals_base
  __h_locals__.merge({
    position: @position ,
    left_columns: @left_columns ,
    columns_next_to_railway_line: @columns_next_to_railway_line ,
    right_columns: @right_columns ,
    columns: columns
  })
end