Sha256: 559b5833ba459bf0ca2298cfba8baf496914a7ba17a3bfa281621c5fa279a7fe

Contents?: true

Size: 471 Bytes

Versions: 4

Compression:

Stored size: 471 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

4 entries across 4 versions & 1 rubygems

Version Path
faker_maker-1.1.7 lib/faker_maker/base.rb
faker_maker-1.1.6 lib/faker_maker/base.rb
faker_maker-1.1.5 lib/faker_maker/base.rb
faker_maker-1.1.4 lib/faker_maker/base.rb