Class: Mirrors::ObjectMirror

Inherits:
Mirror
  • Object
show all
Defined in:
lib/mirrors/object_mirror.rb

Overview

A mirror class. It is the most generic mirror and should be able to reflect on any object you can get at in a given system.

Direct Known Subclasses

ClassMirror

Instance Method Summary collapse

Methods inherited from Mirror

#initialize, #mirrors?, #name, #reflectee, #subject_id

Constructor Details

This class inherits a constructor from Mirrors::Mirror

Instance Method Details

#target_classClassMirror

Returns the a class mirror on the runtime class object.

Returns:

  • (ClassMirror)

    the a class mirror on the runtime class object



11
12
13
# File 'lib/mirrors/object_mirror.rb', line 11

def target_class
  Mirrors.reflect(@subject.class)
end

#variablesFieldMirror

Returns the instance variables of the object.

Returns:

  • (FieldMirror)

    the instance variables of the object



6
7
8
# File 'lib/mirrors/object_mirror.rb', line 6

def variables
  field_mirrors(@subject.instance_variables)
end