Sha256: 58b3e7936ba043704a29d328c61cecee925c711378082a762389eb189532bfeb
Contents?: true
Size: 391 Bytes
Versions: 1
Compression:
Stored size: 391 Bytes
Contents
def class_factory(opts = {}, &block) Class.new(described_class).tap do |klass| klass.class_eval(&block) if block_given? Object.const_set(opts[:real_class_name], klass) if opts[:real_class_name] klass.class_eval("def self.name; \"#{name}\"; end") if opts[:name] end end def object_factory(opts = {}, &block) class_factory(opts, &block).new(opts.fetch(:params, {})) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
light_params-1.0.0 | spec/support/factory_helper.rb |