Sha256: c0fb10aabd7e62ea3fab784b3f54e7e1595cd6d77253b0e270e741bf11e7b51a

Contents?: true

Size: 767 Bytes

Versions: 3

Compression:

Stored size: 767 Bytes

Contents

require 'active_support'
require 'active_support/core_ext/string'
require 'active_support/core_ext/hash'
require 'active_support/core_ext/object/json'
require 'faker_maker/version'
require 'faker_maker/base'
require 'faker_maker/factory'
require 'faker_maker/definition_proxy'
require 'faker_maker/attribute'

module FakerMaker
  extend FakerMaker::Base

  class Error < StandardError; end
  # Your code goes here...

  module_function

  def register_factory factory
    factory.assemble
    factories[factory.name] = factory
  end

  def factories
    @factories ||= {}
  end

  def build name
    factory = factories[name]
    raise "No such factory '#{name}'" if factory.nil?
    factory.build
  end

  def [] name
    factories[name]
  end

end

FM = FakerMaker

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
faker_maker-0.7.1 lib/faker_maker.rb
faker_maker-0.7.0 lib/faker_maker.rb
faker_maker-0.6.0 lib/faker_maker.rb