Class: Machinist::DataMapper::Blueprint

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

Instance Method Summary collapse

Instance Method Details

#box(object) ⇒ Object



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

def box(object)
  object.key
end

#lathe_classObject

:nodoc:



25
26
27
# File 'lib/machinist/data_mapper/blueprint.rb', line 25

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

#make!(attributes = {}) ⇒ Object

Make and save an object.



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

def make!(attributes = {})
  object = make(attributes)
  original_save_behaviour = object.raise_on_save_failure
  object.raise_on_save_failure = true
  object.save
  object.raise_on_save_failure = original_save_behaviour
  object.reload
end

#outside_transactionObject



21
22
23
# File 'lib/machinist/data_mapper/blueprint.rb', line 21

def outside_transaction
  yield # FIXME: This is not actually implemented
end

#unbox(key) ⇒ Object



17
18
19
# File 'lib/machinist/data_mapper/blueprint.rb', line 17

def unbox(key)
  @klass.get(*key)
end