Sha256: 45e4268f921313b75d38ebc0b87328ca04e81eb06f996c48b4fc0135a576355c
Contents?: true
Size: 524 Bytes
Versions: 10
Compression:
Stored size: 524 Bytes
Contents
module XporterOnDemand module Factory def self.create(name, superclass, args = {}) i_vars = args.delete(:i_vars) || {} namespace = args.delete(:namespace) || superclass unless namespace.const_defined?(name, false) s_class = Class.new(superclass) namespace.const_set(name, s_class) end namespace.const_get(name).new(args).tap do |klass| i_vars.each do |i_var, value| klass.instance_variable_set(i_var, value) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems