Sha256: 49ef66f9e147f69d52ce6f8bee1cbc48549ac7fdfae824ac8e1f7eec7715588d

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

class TokyoMetro::App::Renderer::FareTable::ToEachRailwayLine::Rows < TokyoMetro::Factory::Decorate::MetaClass

  def initialize( request , station_infos , fares , normal_fare_groups , to_make_empty_row_when_no_station: false )
    super( request )
    @station_infos = station_infos
    @fares = fares
    @normal_fare_groups = normal_fare_groups
    @to_make_empty_row_when_no_station = to_make_empty_row_when_no_station
  end

  def render
    if @station_infos.blank? and @to_make_empty_row_when_no_station
      render_empty_row_when_no_station
    elsif @station_infos.present?
      render_normal_rows
    end
  end

  private

  def render_empty_row_when_no_station
    h.render inline: <<-HAML , type: :haml
%tr{ class: :empty_row }<
  %td{ colspan:5 }<
    HAML
  end

  def render_normal_rows
    ::TokyoMetro::App::Renderer::FareTable::ToEachRailwayLine::StationInfos.make_group_from( request , @station_infos , @fares , @normal_fare_groups ).render
  end

  def h_locals
    super.merge({
      # station_infos: @station_infos ,
      # fares: @fares ,
      normal_fare_groups: @normal_fare_groups ,
      station_infos_grouped_by_fare: station_infos_grouped_by_fare
    })
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/app/renderer/fare_table/to_each_railway_line/rows.rb