module ToFactory

Constants

AlreadyExists
VERSION

Attributes

factories[RW]
models[RW]

Public Class Methods

definition_for(item) click to toggle source
# File lib/to_factory.rb, line 24
def definition_for(item)
  if item.is_a? ActiveRecord::Base
    Representation.from(item).definition
  else
    if found = representations.find{|r| r.name.to_s == item.to_s }
      found.definition
    else
      raise NotFoundError.new "No definition found for #{item}"
    end
  end
end
definitions() click to toggle source
# File lib/to_factory.rb, line 36
def definitions
  representations.map(&:name)
end
representations() click to toggle source
# File lib/to_factory.rb, line 40
def representations
  Finders::Factory.new.call
end
reset_config!() click to toggle source
# File lib/to_factory/config.rb, line 5
def reset_config!
  @factories = nil
  @models = nil
end