Module: FakerMaker
- Extended by:
- Base, Configurable
- Defined in:
- lib/faker_maker.rb,
lib/faker_maker/base.rb,
lib/faker_maker/naming.rb,
lib/faker_maker/factory.rb,
lib/faker_maker/version.rb,
lib/faker_maker/attribute.rb,
lib/faker_maker/auditable.rb,
lib/faker_maker/naming/json.rb,
lib/faker_maker/configuration.rb,
lib/faker_maker/lifecycle_hooks.rb,
lib/faker_maker/definition_proxy.rb,
lib/faker_maker/naming/json_capitalized.rb
Overview
FakerMaker module for generating Fakes
Defined Under Namespace
Modules: Auditable, Base, Configurable, LifecycleHooks, Naming
Classes: Attribute, ChaosConflictingAttributeError, Configuration, DefinitionProxy, Error, Factory, NoSuchAttributeError, NoSuchAttributeNamingStrategy, NoSuchFactoryError
Constant Summary
collapse
- VERSION =
'2.1.2'
Class Method Summary
collapse
Methods included from Base
factory
configuration, configuration=, configure
Class Method Details
.[](name) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/faker_maker.rb', line 50
def []( name )
factory = find_factory(name)
raise NoSuchFactoryError, "No such factory '#{name}'" unless factory
factory
end
|
.build(name) ⇒ Object
46
47
48
|
# File 'lib/faker_maker.rb', line 46
def build( name )
find_factory( name ).build
end
|
.factories ⇒ Object
42
43
44
|
# File 'lib/faker_maker.rb', line 42
def factories
@factories ||= {}
end
|
.find_factory(name) ⇒ Object
57
58
59
|
# File 'lib/faker_maker.rb', line 57
def find_factory( name )
factories[name]
end
|
.register_factory(factory) ⇒ Object
36
37
38
39
40
|
# File 'lib/faker_maker.rb', line 36
def register_factory( factory )
warn "Factory '#{factory.name}' already registered" if factories[factory.name]
factory.assemble
factories[factory.name] = factory
end
|
.shut!(name) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/faker_maker.rb', line 61
def shut!( name )
factory = find_factory( name )
return unless factory
factories[name] = nil
Object.send( :remove_const, factory.class_name )
end
|
.shut_all! ⇒ Object
69
70
71
|
# File 'lib/faker_maker.rb', line 69
def shut_all!
factories.each_key { |f| shut!( f ) }
end
|