Sha256: efc2559bdd70adb3a2eb12df135e20e087c5ced9ef295719b929d5158c8a70a9
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
# ========================================================================= # Ceedling - Test-Centered Build System for C # ThrowTheSwitch.org # Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams # SPDX-License-Identifier: MIT # ========================================================================= module DIY #:nodoc:# class FactoryDef #:nodoc: attr_accessor :name, :target, :class_name, :library def initialize(opts) @name, @target, @library, @auto_require = opts[:name], opts[:target], opts[:library], opts[:auto_require] @class_name = Infl.camelize(@target) @library ||= Infl.underscore(@class_name) if @auto_require end end class Context def construct_factory(key) factory_def = @defs[key] # puts "requiring #{factory_def.library}" require factory_def.library if factory_def.library big_c = get_class_for_name_with_module_delimeters(factory_def.class_name) FactoryFactory.new(big_c) end end class FactoryFactory def initialize(clazz) @class_to_create = clazz end def create(*args) @class_to_create.new(*args) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ceedling-1.0.1 | vendor/diy/lib/diy/factory.rb |
ceedling-1.0.0 | vendor/diy/lib/diy/factory.rb |