Module: DataMapper::LocalObjectSpace

Included in:
Hook::ClassMethods
Defined in:
lib/dm-core/support/local_object_space.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object


3
4
5
6
7
# File 'lib/dm-core/support/local_object_space.rb', line 3

def self.extended(klass)
  (class << klass; self; end).send :attr_accessor, :hook_scopes
  klass.hook_scopes = []
  super
end

Instance Method Details

#object_by_id(object_id) ⇒ Object


9
10
11
# File 'lib/dm-core/support/local_object_space.rb', line 9

def object_by_id(object_id)
  self.hook_scopes.detect { |object| object.object_id == object_id }
end