Module: ROM::Factory
- Includes:
- Dry::Core::Constants
- Defined in:
- lib/rom/factory.rb,
lib/rom/factory/dsl.rb,
lib/rom/factory/builder.rb,
lib/rom/factory/version.rb,
lib/rom/factory/registry.rb,
lib/rom/factory/constants.rb,
lib/rom/factory/factories.rb,
lib/rom/factory/sequences.rb,
lib/rom/factory/attributes.rb,
lib/rom/factory/tuple_evaluator.rb,
lib/rom/factory/attributes/value.rb,
lib/rom/factory/attribute_registry.rb,
lib/rom/factory/attributes/callable.rb,
lib/rom/factory/attributes/sequence.rb,
lib/rom/factory/builder/persistable.rb,
lib/rom/factory/attributes/association.rb
Overview
Main ROM::Factory API
Defined Under Namespace
Modules: Attributes Classes: AttributeRegistry, Builder, DSL, Factories, FactoryNotDefinedError, Registry, Sequences, Structs, TupleEvaluator, UnknownFactoryAttributes
Constant Summary collapse
- DEFAULT_NAME =
'Factories'.freeze
- VERSION =
'0.10.2'
Class Method Summary collapse
-
.configure(name = DEFAULT_NAME, &block) ⇒ Class
Configure a new factory.
- .fake(type, *args) ⇒ Object private
Class Method Details
.configure(name = DEFAULT_NAME, &block) ⇒ Class
Configure a new factory
25 26 27 28 29 30 31 |
# File 'lib/rom/factory.rb', line 25 def self.configure(name = DEFAULT_NAME, &block) klass = Dry::Core::ClassBuilder.new(name: name, parent: Factories).call do |klass| klass.configure(&block) end klass.new(klass.config.rom) end |
.fake(type, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 21 22 |
# File 'lib/rom/factory/dsl.rb', line 14 def fake(type, *args) api = ::Faker.const_get(::Dry::Core::Inflector.classify(type.to_s)) if args[0].is_a?(Symbol) api.public_send(*args) else api.public_send(type, *args) end end |