Sha256: 3cac4413af73f24fa24fdef626be86a4b6eec808d4fa334cbb1caf1a9d688a58

Contents?: true

Size: 465 Bytes

Versions: 9

Compression:

Stored size: 465 Bytes

Contents

# frozen_string_literal: true

module FakerMaker
  # Base module for defining the DSL
  module Base
    def factory(name, options = {}, &block)
      factory = FakerMaker.find_factory(name)
      if factory.nil?
        factory = FakerMaker::Factory.new name, options
        proxy = DefinitionProxy.new factory
        proxy.instance_eval( &block ) if block_given?
        FakerMaker.register_factory factory
      else
        factory
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
faker_maker-2.1.2 lib/faker_maker/base.rb
faker_maker-2.1.1 lib/faker_maker/base.rb
faker_maker-2.0.0 lib/faker_maker/base.rb
faker_maker-1.3.0 lib/faker_maker/base.rb
faker_maker-1.2.1 lib/faker_maker/base.rb
faker_maker-1.2.0 lib/faker_maker/base.rb
faker_maker-1.1.10 lib/faker_maker/base.rb
faker_maker-1.1.9 lib/faker_maker/base.rb
faker_maker-1.1.8 lib/faker_maker/base.rb