Sha256: d3a14ba8e86acf86b69b014d20e47a636be60f3b4a7290325f621f18a5b23765
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
class TokyoMetro::App::Renderer::StationTimetable::Group < TokyoMetro::Factory::Decorate::MetaClass def initialize( request , station_info , station_timetables ) super( request ) @station_info = station_info @station_timetables = station_timetables end def render h.render inline: <<-HAML , type: :haml , locals: h_locals - grouped_by_railway_line.each do | station_timetables_of_each_railway_line | = station_timetables_of_each_railway_line.render HAML end private def grouped_by_railway_line h = ::Hash.new _railway_line_ids = railway_line_ids @station_timetables.each do | station_timetable | r_ids = station_timetable.station_timetable_fundamental_infos.pluck( :railway_line_id ) r_ids.each do | railway_line_id | if h[ railway_line_id ].nil? h[ railway_line_id ] = ::Array.new end h[ railway_line_id ] << station_timetable end end h.sort_keys.map { | railway_line_id , station_timetables | ::TokyoMetro::App::Renderer::StationTimetable::Group::EachRailwayLine.new( request , @station_info , ::RailwayLine.find( railway_line_id ) , station_timetables ) } end def railway_line_ids @station_timetables.map { | station_timetable | station_timetable.railway_lines.pluck( :id ) }.flatten.uniq.sort end def h_locals super.merge({ grouped_by_railway_line: grouped_by_railway_line }) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tokyo_metro-0.10.1 | lib/tokyo_metro/app/renderer/station_timetable/group.rb |