Class: TokyoMetro::Static::Station::RailwayLines

Inherits:
Fundamental::Hash show all
Includes:
ClassNameLibrary::Static::Station, Modules::Common::ToFactory::Seed::Hash
Defined in:
lib/tokyo_metro/static/station/railway_lines.rb

Overview

複数の路線の駅情報を扱うクラス(ハッシュ)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.factory_for_seeding_this_classObject



7
8
9
# File 'lib/tokyo_metro/static/station/railway_lines.rb', line 7

def self.factory_for_seeding_this_class
  factory_for_seeding_hash
end

Instance Method Details

#define_test(title = self.class.upper_namespace.name) ⇒ nil

テスト用メソッド

Parameters:

  • title (Strng) (defaults to: self.class.upper_namespace.name)

    表示するタイトル(設定しない場合は、ハッシュの上位の名前空間の名称)

Returns:

  • (nil)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/tokyo_metro/static/station/railway_lines.rb', line 25

def define_test( title = self.class.upper_namespace.name )
  puts "\*" * 96
  puts ""
  puts "#{title}"
  puts ""

  puts "○ Class"
  puts self.values.map { |v| v.class.name }.uniq.sort
  puts ""
  puts "○ Keys"
  puts self.keys
  puts "" * 2

  puts "○ First Value (#{self.keys.first})"
  puts ""
  first_value = self.values.first
  puts "\[Keys\]"
  puts ""
  puts first_value.keys
  puts ""
  puts "\[Values\]"
  puts first_value.values.map { | v | v.class.name }.uniq.sort

  puts ""
  puts "-" * 64
  puts ""

  [ "odpt.Railway:TokyoMetro.Ginza" , "odpt.Railway:TokyoMetro.Fukutoshin" , "odpt.Railway:Odakyu.Odawara" ].each do | line |
    puts "Line: #{ line }"
    puts ""
    self[ line ].each do | station , info |
      puts info.to_s
    end
    puts "" * 2
  end

  return nil
end

#listObject



11
12
13
# File 'lib/tokyo_metro/static/station/railway_lines.rb', line 11

def list
  self.values.map( &:stations )
end

#seednil

Note:

Api::Station::List.seed から呼び出される。

ハッシュのそれぞれの値(インスタンスの情報)をDBに流し込むメソッド

Returns:

  • (nil)


18
19
20
# File 'lib/tokyo_metro/static/station/railway_lines.rb', line 18

def seed
  super( indent: 1 , not_on_the_top_layer: true )
end