Class: Machinist::MongoMapper::Blueprint

Inherits:
Blueprint
  • Object
show all
Defined in:
lib/machinist/mongo_mapper/blueprint.rb

Instance Method Summary collapse

Instance Method Details

#box(object) ⇒ Object

Box an object for storage in the warehouse.



13
14
15
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 13

def box(object)
  object.id
end

#lathe_classObject

:nodoc:



26
27
28
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 26

def lathe_class #:nodoc:
  Machinist::MongoMapper::Lathe
end

#make!(attributes = {}) ⇒ Object

Make and save an object.

Raises:

  • (NoMethodError)


5
6
7
8
9
10
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 5

def make!(attributes = {})
  object = make(attributes)
  raise NoMethodError, "Embedded Objects cannot be make! ed" if object.class.embeddable?
  object.save! 
  object.reload
end

#outside_transactionObject



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

def outside_transaction
  yield
end

#unbox(id) ⇒ Object

Unbox an object from the warehouse.



18
19
20
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 18

def unbox(id)
  @klass.find(id)
end