Sha256: e5da61183cce5c883cd72125621f1ada90df3dbc15f7b5486f9e2f5016f42339

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

class TokyoMetro::App::Renderer::Concerns::Link::ToRailwayLinePage::ConnectingRailwayLine::MetaClass < TokyoMetro::App::Renderer::Concerns::Link::ToRailwayLinePage::FromStationFacilityPage

  def initialize( request , connecting_railway_line_decorated )
    @connecting_railway_line_decorated = connecting_railway_line_decorated
    super( request , connecting_railway_line_decorated.railway_line.decorate )
  end

  private

  def connecting_railway_line_object
    @connecting_railway_line_decorated.object
  end

  def object
    connecting_railway_line_object
  end

  def to_render?
    connected_to_jr_lines? or @connecting_railway_line_decorated.operated_now?
  end

  def url
    if connected_to_jr_lines?
      nil
    else
      @connecting_railway_line_decorated.url_for_railway_line_page
    end
  end

  def connecting_railway_line_info_decorator?
    @connecting_railway_line_decorated.instance_of?( ::ConnectingRailwayLine::InfoDecorator )
  end

  def valid_railway_line_decorator_class?
    connecting_railway_line_info_decorator?
  end

  def connecting_to_another_station?
    object.connecting_to_another_station?
  end

  def optional_infos_to_display
    ary = ::Array.new
    if has_another_station_info_to_display?
      ary << another_station_info_to_display
    end
    ary
  end

  def has_another_station_info_to_display?
    @display_another_station_info and connecting_to_another_station?
  end

  def another_station_info_to_display
    ::Proc.new {
      h.render inline: <<-HAML , type: :haml , locals: { connecting_station_info: object.connecting_station_info }
= connecting_station_info.decorate.render_connection_info_from_another_station
      HAML
    }
  end

  def connected_to_jr_lines?
    @connecting_railway_line_decorated.instance_of?( ::RailwayLineDecorator ) and connecting_railway_line_object.jr_lines?
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/app/renderer/concerns/link/to_railway_line_page/connecting_railway_line/meta_class.rb