Module: ObjectSpace

Defined in:
lib/openc3/core_ext/objectspace.rb

Overview

OpenC3 specific additions to the ObjectSpace class

Class Method Summary collapse

Class Method Details

.find(klass) ⇒ Object



25
26
27
28
29
30
# File 'lib/openc3/core_ext/objectspace.rb', line 25

def self.find(klass)
  ObjectSpace.each_object(klass) do |object|
    return object
  end
  nil
end

.find_all(klass) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/openc3/core_ext/objectspace.rb', line 32

def self.find_all(klass)
  objects = []
  ObjectSpace.each_object(klass) do |object|
    objects << object
  end
  objects
end