Module: Machinist::MongoMapperExtensions::Document

Defined in:
lib/machinist/mongomapper.rb

Instance Method Summary collapse

Instance Method Details

#make(*args, &block) ⇒ Object



32
33
34
35
36
# File 'lib/machinist/mongomapper.rb', line 32

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

#make_unsaved(*args) ⇒ Object



38
39
40
41
42
# File 'lib/machinist/mongomapper.rb', line 38

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

#plan(*args) ⇒ Object



44
45
46
47
# File 'lib/machinist/mongomapper.rb', line 44

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