Sha256: 91c9b213db16781d13707802ff42046f4a7bbc7fbce814fcab5617b78395b6f2

Contents?: true

Size: 1002 Bytes

Versions: 1

Compression:

Stored size: 1002 Bytes

Contents

class TokyoMetro::Factory::Decorate::Api::TrainLocation::List < TokyoMetro::Factory::Decorate::Api::MetaClass::RealTime::Info

  def initialize( request , obj , railway_line )
    super( request , obj )
    @railway_line = railway_line
  end

  attr_reader :railway_line

  def render
    h.render inline: <<-HAML , type: :haml , locals: h_locals
- grouped_by_railway_direction.each do | list_of_each_direction |
  = list_of_each_direction.render
    HAML
  end

  private

  def h_locals
    super.merge({
      grouped_by_railway_direction: grouped_by_railway_direction
    })
  end

  def grouped_by_railway_direction
    @object.before_decorate.group_by_railway_direction( @railway_line ).map { | railway_direction_in_api_same_as , train_location_infos |
      ::TokyoMetro::Factory::Decorate::Api::TrainLocation::List::EachDirection.new( @request , @railway_line , railway_direction_in_api_same_as , train_location_infos )
    }.sort_by { | item |
      item.railway_direction.id
    }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/decorate/api/train_location/list.rb