class TokyoMetro::Factory::Generate::Static::MetaClass::Group::Fundamental::FromHash

各種ハッシュを作成するための Factory クラス - 1. 基本(ハッシュから)

Private Class Methods

hash_class() click to toggle source

ハッシュのクラス @return [Const (class name)]

# File lib/tokyo_metro/factory/generate/static/meta_class/group/fundamental/from_hash.rb, line 24
def self.hash_class
  raise "The class method \"#{__method__}\" is not defined yet in this class."
end
hash_class_for_this_factory() click to toggle source
# File lib/tokyo_metro/factory/generate/static/meta_class/group/fundamental/from_hash.rb, line 18
def self.hash_class_for_this_factory
  hash_class
end

Private Instance Methods

generating_procedure( d_yaml ) click to toggle source

YAML ファイルからインスタンスを生成する際のロジック @return [Proc]

# File lib/tokyo_metro/factory/generate/static/meta_class/group/fundamental/from_hash.rb, line 8
def generating_procedure( d_yaml )
  raise "Error" unless d_yaml.instance_of?( ::Hash )

  group_new = self.class.hash_class_for_this_factory.new
  d_yaml.each do | key , value |
    group_new[ key ] = self.class.info_class_for_this_factory.generate_from_hash( key , value )
  end
  group_new
end