Sha256: bc8affc8a44b287e4c8bbc2cf5e86fc436f73aacb23dfaf9a628b5654b42ab57
Contents?: true
Size: 798 Bytes
Versions: 11
Compression:
Stored size: 798 Bytes
Contents
# encoding: utf-8 module Flextures # ロードするデータを必要に応じて加工する class Factory # 設置ファイルから取得した Factoryの一覧を取得 FACTORIES={} # Factory を定義 # @params table_name # @params options # @params block # @return Flextures::Factory def self.define table_name, *options, &block h={ block: block } options.each do |o| begin h[:model] = o if o.new.is_a? ActiveRecord::Base rescue end end FACTORIES[table_name.to_sym]=h end # Factoryを取得 def self.get table_name f = FACTORIES[table_name.to_sym] f && f[:block] end def self.[](table_name); self.get(table_name); end end end
Version data entries
11 entries across 11 versions & 1 rubygems