Module: ToFactory

Defined in:
lib/to_factory.rb,
lib/to_factory/config.rb,
lib/to_factory/version.rb,
lib/to_factory/collation.rb,
lib/to_factory/file_sync.rb,
lib/to_factory/file_writer.rb,
lib/to_factory/parsing/file.rb,
lib/to_factory/finders/model.rb,
lib/to_factory/options_parser.rb,
lib/to_factory/parsing/syntax.rb,
lib/to_factory/representation.rb,
lib/to_factory/finders/factory.rb,
lib/to_factory/klass_inference.rb,
lib/to_factory/generation/factory.rb,
lib/to_factory/parsing/new_syntax.rb,
lib/to_factory/parsing/old_syntax.rb,
lib/to_factory/generation/attribute.rb

Defined Under Namespace

Modules: Finders, Generation, Parsing Classes: CannotInferClass, Collation, FileSync, FileWriter, KlassInference, MissingActiveRecordInstanceException, OptionsParser, Representation

Constant Summary collapse

VERSION =
"0.2.0"
AlreadyExists =
Class.new ArgumentError

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.factoriesObject

Returns the value of attribute factories.



3
4
5
# File 'lib/to_factory/config.rb', line 3

def factories
  @factories
end

.modelsObject

Returns the value of attribute models.



3
4
5
# File 'lib/to_factory/config.rb', line 3

def models
  @models
end

Class Method Details

.definitionsObject



30
31
32
33
# File 'lib/to_factory.rb', line 30

def definitions
  results = Finders::Factory.new.call
  results.map(&:name)
end

.new_syntax?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
28
# File 'lib/to_factory.rb', line 19

def new_syntax?
  require "factory_girl"
  if FactoryGirl::VERSION.to_s[0..0].to_i > 1
    true
  else
    false
  end
rescue NameError, ArgumentError
  false
end

.reset_config!Object



5
6
7
8
# File 'lib/to_factory/config.rb', line 5

def reset_config!
  @factories = nil
  @models = nil
end