Class: Maglev::Reflection

Inherits:
Ruby::Reflection show all
Defined in:
lib/maglev/reflection.rb,
lib/maglev/reflection/mirror.rb,
lib/maglev/reflection/class_mirror.rb,
lib/maglev/reflection/field_mirror.rb,
lib/maglev/reflection/method_mirror.rb,
lib/maglev/reflection/object_mirror.rb,
lib/maglev/reflection/thread_mirror.rb,
lib/maglev/reflection/stack_frame_mirror.rb,
lib/maglev/reflection/field_mirror/fixed_instance_variable_mirror.rb

Defined Under Namespace

Classes: ClassMirror, FieldMirror, FixedInstanceVariableMirror, MethodMirror, Mirror, ObjectMirror, StackFrameMirror, ThreadMirror

Instance Method Summary collapse

Methods inherited from Ruby::Reflection

codebase, #engine, #initialize, #instances_of, #object_by_id, #platform, #threads, #version

Methods included from AbstractReflection

#engine, included, #initialize, #instances_of, #object_by_id, #platform, #reflect, #threads, #version

Constructor Details

This class inherits a constructor from Ruby::Reflection

Instance Method Details

#classesObject



10
11
12
# File 'lib/maglev/reflection.rb', line 10

def classes
  mirror_modules_satisfying {|m| Class === m }
end

#implementations_of(str) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/maglev/reflection.rb', line 14

def implementations_of(str)
  if sym = Symbol.__existing_symbol(str.to_s)
    class_list = ClassOrganizer.cached_organizer.implementors_of sym
    class_list.collect {|cls| self.reflect(cls).method sym }
  else
    []
  end
end

#modulesObject



6
7
8
# File 'lib/maglev/reflection.rb', line 6

def modules
  mirror_modules_satisfying {|m| Module === m && !(Class === m) }
end

#senders_of(str) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/maglev/reflection.rb', line 23

def senders_of(str)
  if sym = Symbol.__existing_symbol(str.to_s)
    meth_list = ClassOrganizer.cached_organizer.senders_of sym
    meth_list.collect do |m|
      self.reflect(m.__in_class).method m.__name
    end
  else
    []
  end
end