-require_dependency "manifest/model/attribute/source/model"
-require_dependency "manifest/model/attribute/source/magic_number"
+ManifestBase.require_modules "manifest/model/attribute/source/",
+ %w|base model magic_number|
+
module Manifest
module ModelModule
module AttributeModule
- class SourceFactory
+ class SourceFactory < ManifestBase::Factory
include SourceModule
- @@types = {
- 'model' => ModelSource, 'magic_number' => MagicNumberSource
- }
- def self.factory attribute, attribute_name, my_manifest
- type = my_manifest['type']
- raise "undefined type for models > #{attribute.mode_name} > attributes > #{attribute_name} > source\n" unless type
- my_class = @@types[type]
- raise "undefined class for models > #{attribute.mode_name} > attributes > #{attribute_name} > source > #{type}\n" unless my_class
- my_class.new(attribute, my_manifest)
+
+ def self.types
+ {
+ 'model' => ModelSource, 'magic_number' => MagicNumberSource
+ }
+ end
+
+ def self.default_type
+ 'magic_number'
end
end