Module: Mack::Data::Factory

Defined in:
lib/mack-data_factory/data_factory.rb,
lib/mack-data_factory/content_generator.rb

Overview

Add factory capability to a class.

A factory is able to define which field it want to generate content for, define a scope for different situation, and set a custom content generator for field that doesn’t want to use the default content generator.

You must add this module when creating a factory class; and the name of the factory class should be following this format:

#{model_name_camelcase}Factory

Example:

If there's a model class named "Item", then its factory must be:

class ItemFactory
  include Mack::Data::Factory
  ...
end

See Mack::Data::Factory::ClassMethods for the factory API and examples.

Author

Darsono Sutedja

Date

July 2008

Defined Under Namespace

Modules: ClassMethods Classes: FieldContentGenerator

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



29
30
31
# File 'lib/mack-data_factory/data_factory.rb', line 29

def self.included(base) # :nodoc:
  base.extend ClassMethods
end