Method: FakerMaker::Factory#initialize

Defined in:
lib/faker_maker/factory.rb

#initialize(name, options = {}) ⇒ Factory

Returns a new instance of Factory.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/faker_maker/factory.rb', line 10

def initialize( name, options = {} )
  assert_valid_options options
  @name = name.respond_to?(:to_sym) ? name.to_sym : name.to_s.underscore.to_sym
  @class_name = (options[:class] || @name).to_s.camelcase
  @naming_strategy = case options[:naming]
                     when :json
                       FakerMaker::Naming::JSON
                     when :json_capitalized, :json_capitalised
                       FakerMaker::Naming::JSONCapitalized
                     when nil
                       nil
                     else
                       raise FakerMaker::NoSuchAttributeNamingStrategy, options[:naming]
                     end
  @attributes = []
  @klass = nil
  @parent = options[:parent]
end