class Pickle::Adapter::Fabrication

fabrication adapter

Public Class Methods

factories() click to toggle source
# File lib/pickle/adapter.rb, line 137
def self.factories
  if defined? ::Fabrication
    ::Fabrication::Support.find_definitions if ::Fabrication::Fabricator.schematics.empty?
    ::Fabrication::Fabricator.schematics.collect{|v| new(v)}
  else
    []
  end
end
new(factory) click to toggle source
# File lib/pickle/adapter.rb, line 146
def initialize(factory)
  if defined? ::Fabrication
    @klass, @name = factory[1].klass, factory[0].to_s
  end
end

Public Instance Methods

create(attrs = {}) click to toggle source
# File lib/pickle/adapter.rb, line 152
def create(attrs = {})
  if defined? ::Fabrication
    ::Fabrication::Fabricator.generate(@name.to_sym, {
        :save => true
        }, attrs)
  end
end