Module: Machinist::MongoMapperExtensions

Defined in:
lib/machinist/mongomapper.rb

Instance Method Summary collapse

Instance Method Details

#make(*args, &block) ⇒ Object



10
11
12
13
14
# File 'lib/machinist/mongomapper.rb', line 10

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



16
17
18
19
20
# File 'lib/machinist/mongomapper.rb', line 16

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

#plan(*args) ⇒ Object



22
23
24
# File 'lib/machinist/mongomapper.rb', line 22

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