Module: Machinist::SequelExtensions::ClassMethods

Defined in:
lib/machinist/sequel.rb

Instance Method Summary collapse

Instance Method Details

#make(*args, &block) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/machinist/sequel.rb', line 36

def make(*args, &block)
  lathe = Lathe.run(Machinist::SequelAdapter, self.new, *args)
  unless Machinist.nerfed?
    lathe.object.save
    lathe.object.refresh
  end
  lathe.object(&block)
end

#make_unsaved(*args) ⇒ Object



45
46
47
48
49
# File 'lib/machinist/sequel.rb', line 45

def make_unsaved(*args)
  returning(Machinist.with_save_nerfed { make(*args) }) do |object|
    yield object if block_given?
  end
end

#plan(*args) ⇒ Object



51
52
53
54
# File 'lib/machinist/sequel.rb', line 51

def plan(*args)
  lathe = Lathe.run(Machinist::SequelAdapter, self.new, *args)
  Machinist::SequelAdapter.assigned_attributes_without_associations(lathe)
end