Sha256: 0c9c336e2452b8220a3b9d56a41b9c912c099aa898fb9e93f22a23a5d0a1376b

Contents?: true

Size: 846 Bytes

Versions: 50

Compression:

Stored size: 846 Bytes

Contents

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

50 entries across 50 versions & 1 rubygems

Version Path
ceedling-0.31.1 vendor/diy/lib/diy/factory.rb
ceedling-0.31.0 vendor/diy/lib/diy/factory.rb
ceedling-0.30.0 vendor/diy/lib/diy/factory.rb
ceedling-0.28.3 vendor/diy/lib/diy/factory.rb
ceedling-0.28.2 vendor/diy/lib/diy/factory.rb
ceedling-0.28.1 vendor/diy/lib/diy/factory.rb
ceedling-0.27.0 vendor/diy/lib/diy/factory.rb
ceedling-0.25.0 vendor/diy/lib/diy/factory.rb
ceedling-0.24.0 vendor/diy/lib/diy/factory.rb
ceedling-0.22.0 vendor/diy/lib/diy/factory.rb
ceedling-0.21.0 vendor/diy/lib/diy/factory.rb
ceedling-0.20.3 vendor/diy/lib/diy/factory.rb
ceedling-0.20.2 vendor/diy/lib/diy/factory.rb
ceedling-0.19.0 vendor/diy/lib/diy/factory.rb
ceedling-0.18.0 vendor/diy/lib/diy/factory.rb
ceedling-0.17.0 vendor/diy/lib/diy/factory.rb
ceedling-0.16.0 vendor/diy/lib/diy/factory.rb
ceedling-0.15.6 vendor/diy/lib/diy/factory.rb
ceedling-0.15.5 vendor/diy/lib/diy/factory.rb
ceedling-0.15.4 vendor/diy/lib/diy/factory.rb