class TokyoMetro::Factory::Decorate::Api::TrainLocation::Info::Delay

Public Instance Methods

displayed_in_train_operation_info?() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 3
def displayed_in_train_operation_info?
  object.displayed_in_train_operation_info?
end
render_en_in_train_operation_info() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 25
  def render_en_in_train_operation_info
    str = "Max delay: #{ object.to_s_en }"
    h.render inline: <<-HAML , type: :haml , locals: { str: str }
%p{ class: :max_delay }<
  = str
    HAML
  end
render_in_location_of_each_train() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 7
def render_in_location_of_each_train
  if object.on_schedule?
    render_in_location_of_each_train_when_on_schedule
  elsif object.nearly_on_schedule?
    render_in_location_of_each_train_when_nearly_on_schedule
  else
    render_in_location_of_each_train_when_delayed
  end
end
render_in_train_operation_info_precise_version() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 33
  def render_in_train_operation_info_precise_version
    str = "最大遅れ:#{ object.delay.to_s }秒"
    h.render inline: <<-HAML , type: :haml , locals: { str: str }
%div{ class: :max_delay }<
  = str
    HAML
  end
render_ja_in_train_operation_info() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 17
  def render_ja_in_train_operation_info
    str = "現在の遅れ 最大 #{ object.to_s_ja }"
    h.render inline: <<-HAML , type: :haml , locals: { str: str }
%p{ class: :max_delay }<
  = str
    HAML
  end

Private Instance Methods

render_in_location_of_each_train_when_delayed( status_name = :delayed ) click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 60
  def render_in_location_of_each_train_when_delayed( status_name = :delayed )
    main_str = object.to_s_separated_by_comma
    h.render inline: <<-HAML , type: :haml , locals: { main_str: main_str , status_name: status_name }
%li{ class: [ :time_info , status_name , :clearfix ] }
  %div{ class: :icon }<
    = ::TokyoMetro::App::Renderer::Icon.send( status_name , request , 2 ).render
  %div{ class: :title_of_delay }
    %p{ class: :text_ja }<
      = "遅れ"
      %span{ class: :small }<
        != "(分:秒)"
    %p{ class: :text_en }<>
      = "Delay"
      %span{ class: :small }<
        = "(mm:ss)"
  %div{ class: [ :time , :text_en ] }<
    = main_str
    HAML
  end
render_in_location_of_each_train_when_nearly_on_schedule() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 56
def render_in_location_of_each_train_when_nearly_on_schedule
  render_in_location_of_each_train_when_delayed( status_name = :nearly_on_schedule )
end
render_in_location_of_each_train_when_on_schedule() click to toggle source
# File lib/tokyo_metro/factory/decorate/api/train_location/info/delay.rb, line 43
  def render_in_location_of_each_train_when_on_schedule
    h.render inline: <<-HAML , type: :haml , locals: { request: request }
%li{ class: [ :time_info , :on_schedule , :clearfix ] }
  %div{ class: :icon }<
    = ::TokyoMetro::App::Renderer::Icon.on_schedule( request , 2 ).render
  %div{ class: :text }
    %p{ class: :text_ja }<
      = "平常運転"
    %p{ class: :text_en }<
      = "Now on schedule"
    HAML
  end