Sha256: cfd74a1ca56ff73fa14d1681ea4778c60172f22aa2390ab2824cbcecb3af525b

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

class TokyoMetro::App::Renderer::RealTimeInfos::MetaDatum::Whole < TokyoMetro::Factory::Decorate::MetaClass

  def initialize( request , train_operation_infos , train_location_infos , visibility )
    super( request )
    @visibility = visibility
    @train_operation_infos = ::TokyoMetro::App::Renderer::RealTimeInfos::MetaDatum::TrainOperationInfos.new( request , train_operation_infos )
    if train_location_infos.present?
      @train_location_infos = ::TokyoMetro::App::Renderer::RealTimeInfos::MetaDatum::TrainLocationInfos.new( request , train_location_infos )
    else
      @train_location_infos = nil
    end
  end

  attr_reader :train_operation_infos
  attr_reader :train_location_infos

  def render( include_train_location_infos: nil )
    h.render inline: <<-HAML , type: :haml , locals: h_locals( include_train_location_infos )
%div{ id: :real_time_info_and_update_button , class: visibility }
  = this.render_header
  %ul{ class: :time_infos }
    = this.train_operation_infos.render
    - if this.has_train_location_infos?
      = this.train_location_infos.render( include_train_location_infos: include_train_location_infos )
    HAML
  end

  def render_header
    ::TokyoMetro::App::Renderer::RealTimeInfos::MetaDatum::Whole::Header.new( @request , @visibility ).render
  end

  def has_train_location_infos?
    @train_location_infos.present?
  end

  private

  def h_locals( include_train_location_infos )
    super().merge({
      this: self ,
      include_train_location_infos: include_train_location_infos ,
      visibility: @visibility
    })
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb