class TokyoMetro::Factory::Generate::Static::RailwayLine::Info

Public Class Methods

hash_keys() click to toggle source
# File lib/tokyo_metro/factory/generate/static/railway_line/info.rb, line 6
def self.hash_keys
  [ :name_ja , :name_hira , :name_en , :name_code , :operator , :index , :color , :start_on , :end_on , :twitter_widget_id , :twitter_account_name ]
end

Private Instance Methods

color_instance() click to toggle source

色情報のインスタンスを取得するメソッド @param color_base [Hash or ::Array<Hash>] 色情報のもととなるハッシュ(またはハッシュの配列) @return [::TokyoMetro::Static::Color] 与えられた変数 color_base がハッシュの場合 @return [::Array <::TokyoMetro::Static::Color>] 与えられた変数 color_base がハッシュの配列の場合

# File lib/tokyo_metro/factory/generate/static/railway_line/info.rb, line 34
def color_instance
  color_base = @h[ :color ]
  if color_base.nil?
    nil
  elsif color_base.kind_of?( ::Hash )
    [ ::TokyoMetro::Static::Color.generate_from_hash( color_base ) ]
  elsif color_base.instance_of?( ::Array ) and color_base.all? { |i| i.kind_of?( ::Hash ) }
    color_base.map { | each_color | ::TokyoMetro::Static::Color::generate_from_hash( each_color ) }
  else
    raise "Error"
  end
end
operator_instance() click to toggle source

事業者のインスタンスを取得するメソッド @return [::TokyoMetro::Static::Operator::Info]

# File lib/tokyo_metro/factory/generate/static/railway_line/info.rb, line 24
def operator_instance
  operator = ::TokyoMetro::Static.operators[ @h[ :operator ] ]
  raise "Error: The operator is not defined." if operator.nil?
  operator
end
set_values_to_hash_for_making_variables() click to toggle source
# File lib/tokyo_metro/factory/generate/static/railway_line/info.rb, line 12
def set_values_to_hash_for_making_variables
  super( hash_key_array: [ :name_ja , :name_hira , :name_en , :name_code ] , make_array: true )
  super( hash_key_array: [ :twitter_widget_id , :twitter_account_name , :index ] )

  @hash_for_making_variables[ :color ] = color_instance
  @hash_for_making_variables[ :operator ] = operator_instance
  @hash_for_making_variables[ :start_on ] = set_time_of( @h[ :start_on ] , type: :start_on )
  @hash_for_making_variables[ :end_on ] = set_time_of( @h[ :end_on ] , type: :end_on )
end