Class: TokyoMetro::App::Renderer::RealTimeInfos::MetaDatum::Whole

Inherits:
Factory::Decorate::MetaClass show all
Defined in:
lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb

Defined Under Namespace

Classes: Header

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, train_operation_infos, train_location_infos, visibility) ⇒ Whole

Returns a new instance of Whole.



3
4
5
6
7
8
9
10
11
12
# File 'lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb', line 3

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

Instance Attribute Details

#train_location_infosObject (readonly)

Returns the value of attribute train_location_infos.



15
16
17
# File 'lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb', line 15

def train_location_infos
  @train_location_infos
end

#train_operation_infosObject (readonly)

Returns the value of attribute train_operation_infos.



14
15
16
# File 'lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb', line 14

def train_operation_infos
  @train_operation_infos
end

Instance Method Details

#has_train_location_infos?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb', line 32

def has_train_location_infos?
  @train_location_infos.present?
end

#render(include_train_location_infos: nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb', line 17

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

#render_headerObject



28
29
30
# File 'lib/tokyo_metro/app/renderer/real_time_infos/meta_datum/whole.rb', line 28

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