Module: TokyoMetro::App::Renderer::TravelTimeInfo::RailwayLine

Defined in:
lib/tokyo_metro/app/renderer/travel_time_info/railway_line.rb

Defined Under Namespace

Modules: YurakuchoAndFukutoshinLine Classes: ChiyodaLine, FukutoshinLine, GinzaLine, HanzomonLine, HibiyaLine, MarunouchiLine, NambokuLine, TozaiLine, YurakuchoLine

Class Method Summary collapse

Class Method Details

.instance_of(request, railway_lines) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/tokyo_metro/app/renderer/travel_time_info/railway_line.rb', line 3

def self.instance_of( request , railway_lines )
  railway_lines = [ railway_lines ].flatten
  case railway_lines.length
  when 1
    railway_line = railway_lines.first
    class_name_of_instance_for_one_railway_line( railway_line ).new( request , railway_line )
  when 2
    class_name_of_instance_for_multiple_railway_lines( railway_lines ).new( request , railway_lines )
  else
    raise "Error: \"#{ railway_lines.pluck( :same_as ).to_s }\" is not valid."
  end
end