Module: ObjectSpace

Extended by:
Enumerable
Defined in:
lib/rmtools/enumerable/object_space.rb

Class Method Summary collapse

Methods included from Enumerable

+, b, dump, export, foldl, foldr, import, map_hash, present, rand, randsample, recursive_find, recursive_select, threadify, to_traversable, truth_map, urlencode, xprod

Class Method Details

.each(&b) ⇒ Object



8
# File 'lib/rmtools/enumerable/object_space.rb', line 8

def each(&b) each_object(&b) end

.find(id = nil) ⇒ Object Also known as: []



12
13
14
15
16
17
18
19
# File 'lib/rmtools/enumerable/object_space.rb', line 12

def find(id=nil)
  if id
    find {|obj| obj.object_id == id} 
  else
    each_object {|obj| return obj if yield obj}
    nil
  end
end

.sizeObject



10
# File 'lib/rmtools/enumerable/object_space.rb', line 10

def size() each_object {} end