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

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

Public Class Methods

list_class() click to toggle source

配列のクラス @return [Const (class name)]

# File lib/tokyo_metro/factory/generate/static/meta_class/group/fundamental/from_list.rb, line 22
def self.list_class
  raise "The class method \"#{__method__}\" is not defined yet in this class."
end
list_class_for_this_factory() click to toggle source
# File lib/tokyo_metro/factory/generate/static/meta_class/group/fundamental/from_list.rb, line 16
def self.list_class_for_this_factory
  list_class
end

Public 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_list.rb, line 6
def generating_procedure( d_yaml )
  raise "Error" unless d_yaml.instance_of?( ::Array )

  ary = ::Array.new
  d_yaml.each do | item |
    ary << self.class.info_class_for_this_factory.generate_from_hash( item )
  end
  self.class.list_class_for_this_factory.new( ary )
end