Sha256: c026b4971b0bbff001d266079041e8de0edab80c212c0ddfb0c30fa2bea8e919
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
class TokyoMetro::App::Renderer::FareTable::Group < TokyoMetro::Factory::Decorate::MetaClass def initialize( request , station_info , railway_line_of_terminal_station ) super( request ) @normal_fare_groups = ::NormalFareGroup.all @station_info = station_info @railway_lines_of_terminal_station = [ railway_line_of_terminal_station ].flatten end def render h.render inline: <<-HAML , type: :haml , locals: h_locals %div{ id: :fare_tables } - railway_lines_of_terminal_station.each do | railway_line | = ::TokyoMetro::App::Renderer::FareTable::ToEachRailwayLine.new( request , railway_line , station_infos_including_other_railway_lines , starting_station_info , fares , normal_fare_groups ).render HAML end private def h_locals super.merge({ station_infos_including_other_railway_lines: station_infos_including_other_railway_lines , starting_station_info: starting_station_info , fares: fares , normal_fare_groups: @normal_fare_groups , railway_lines_of_terminal_station: @railway_lines_of_terminal_station }) end def station_infos_including_other_railway_lines @station_info.station_infos_including_other_railway_lines end def starting_station_info station_infos_including_other_railway_lines.first end def to_station_info_ids @railway_lines_of_terminal_station.map( &:station_infos ).flatten.map( &:id ).sort.uniq end def fares ::Fare.where( from_station_info_id: starting_station_info.id , to_station_info_id: to_station_info_ids ).includes( :from_station_info , :to_station_info , :normal_fare_group ) 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/group.rb |