Class: Object

Inherits:
BasicObject
Defined in:
lib/core_ext/object.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.detach_allObject

A convenience method for detaching all class instances with detach



5
6
7
# File 'lib/core_ext/object.rb', line 5

def self.detach_all
  Mass.index(self.class)[self.class.name].each{|object_id| Mass[object_id].detach}
end

.detach_all!Object

A convenience method for detaching all class instances with detach!



11
12
13
# File 'lib/core_ext/object.rb', line 11

def self.detach_all!
  Mass.index(self.class)[self.class.name].each{|object_id| Mass[object_id].detach!}
end

Instance Method Details

#_reference_instances(*mods) ⇒ Object

Mass uses this method to derive object references. Override this method for increasing performance. In order to override this method, you would probably want to use Mass.references of a sample instance.



18
19
20
# File 'lib/core_ext/object.rb', line 18

def _reference_instances(*mods)
  Mass.send(:instances_within, *mods)
end

#detach(*mods, &block) ⇒ Object

A convenience method for Mass.detach



30
31
32
# File 'lib/core_ext/object.rb', line 30

def detach(*mods, &block)
  Mass.detach(self, *mods, &block)
end

#detach!(*mods, &block) ⇒ Object

A convenience method for Mass.detach!



36
37
38
# File 'lib/core_ext/object.rb', line 36

def detach!(*mods, &block)
  Mass.detach!(self, *mods, &block)
end

#references(*mods) ⇒ Object

A convenience method for Mass.references



24
25
26
# File 'lib/core_ext/object.rb', line 24

def references(*mods)
  Mass.references(self, *mods)
end