class Mirrors::ObjectMirror

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.

Public Instance Methods

target_class() click to toggle source

@return [ClassMirror] the a class mirror on the runtime class object

# File lib/mirrors/object_mirror.rb, line 11
def target_class
  Mirrors.reflect(@subject.class)
end
variables() click to toggle source

@return [FieldMirror] the instance variables of the object

# File lib/mirrors/object_mirror.rb, line 6
def variables
  field_mirrors(@subject.instance_variables)
end

Private Instance Methods

field_mirror(subject, name) click to toggle source
# File lib/mirrors/object_mirror.rb, line 21
def field_mirror(subject, name)
  Mirrors.reflect(FieldMirror::Field.new(subject, name))
end
field_mirrors(list, subject = @subject) click to toggle source
# File lib/mirrors/object_mirror.rb, line 17
def field_mirrors(list, subject = @subject)
  list.map { |name| field_mirror(subject, name) }
end