Module: TokyoMetro::TempLib::RailwayLineArrayModule

Defined in:
lib/tokyo_metro/temp_lib/railway_line_array_module.rb

Instance Method Summary collapse

Instance Method Details

#to_railway_line_name_text_enObject

タイトルの路線名(ローマ字表記)を取得するメソッド



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tokyo_metro/temp_lib/railway_line_array_module.rb', line 19

def to_railway_line_name_text_en
  if self.empty?
    "Undefined"
  elsif normal_line? or marunouchi_line_including_branch? or chiyoda_line?
    self.first.name_en
  elsif yurakucho_and_fukutoshin_line?
    self.map { | railway_line | railway_line.name_en.gsub( / Line\Z/ , "" ) }.join( " and " ) + " Line"
  else
    raise "Error"
  end
end

#to_railway_line_name_text_jaObject

タイトルの路線名(日本語表記)を取得するメソッド



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tokyo_metro/temp_lib/railway_line_array_module.rb', line 4

def to_railway_line_name_text_ja
  if normal_line?
    self.first.name_ja
  elsif marunouchi_line_including_branch?
    self.find { | railway_line | railway_line.same_as == "odpt.Railway:TokyoMetro.Marunouchi" }.name_ja
  elsif chiyoda_line?
    self.find { | railway_line | railway_line.same_as == "odpt.Railway:TokyoMetro.Chiyoda" }.name_ja
  elsif yurakucho_and_fukutoshin_line?
    self.map( &:name_ja ).join( "" )
  else
    raise "Error: " + self.map( &:name_ja ).to_s
  end
end

#to_title_color_classObject

路線色の SCSS のクラスを取得するメソッド



32
33
34
35
36
37
38
39
40
# File 'lib/tokyo_metro/temp_lib/railway_line_array_module.rb', line 32

def to_title_color_class
  if self.empty?
    "default"
  elsif normal_line? or marunouchi_line_including_branch? or chiyoda_line?
    self.first.css_class_name
  else
    self.map( &:css_class_name ).join( "_" )
  end
end