Class: SystemNavigation::RubyEnvironment Private
- Inherits:
-
Object
- Object
- SystemNavigation::RubyEnvironment
- Defined in:
- lib/system_navigation/ruby_environment.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#all_behaviors(&block) ⇒ Enumerator
private
Execute
block
on each class, metaclass, module and module’s metaclass. -
#all_classes(&block) ⇒ Enumerator
private
Execute
block
on each class (but not its metaclass). -
#all_classes_and_modules(&block) ⇒ Enumerator
private
Execute
block
on each class and module (but not their metaclasses). -
#all_modules(&block) ⇒ Enumerator
private
Execute
block
on each module (but not its metaclass). -
#all_objects(&block) ⇒ Enumerator
private
Execute
block
on each object.
Instance Method Details
#all_behaviors(&block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute block
on each class, metaclass, module and module’s metaclass.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/system_navigation/ruby_environment.rb', line 10 def all_behaviors(&block) enum = Enumerator.new do |y| ObjectSpace.each_object(Module) do |klass| y.yield klass y.yield klass.singleton_class end end if block_given? enum.each(&block) else enum end end |
#all_classes(&block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute block
on each class (but not its metaclass).
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/system_navigation/ruby_environment.rb', line 30 def all_classes(&block) enum = Enumerator.new do |y| ObjectSpace.each_object(Class) do |klass| y.yield klass end end if block_given? enum.each(&block) else enum end end |
#all_classes_and_modules(&block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute block
on each class and module (but not their metaclasses).
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/system_navigation/ruby_environment.rb', line 49 def all_classes_and_modules(&block) enum = Enumerator.new do |y| ObjectSpace.each_object(Module) do |klass| y.yield klass end end if block_given? enum.each(&block) else enum end end |
#all_modules(&block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute block
on each module (but not its metaclass).
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/system_navigation/ruby_environment.rb', line 68 def all_modules(&block) enum = Enumerator.new do |y| self.all_classes_and_modules.each do |klass| y.yield(klass) if klass.instance_of?(Module) end end if block_given? enum.each(&block) else enum end end |
#all_objects(&block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute block
on each object.
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/system_navigation/ruby_environment.rb', line 87 def all_objects(&block) enum = Enumerator.new do |y| ObjectSpace.each_object do |obj| y.yield obj end end if block_given? enum.each(&block) else enum end end |