Module: AbstractReflection::Mirror

Extended by:
ClassMethods
Included in:
ObjectMirror, Ruby::Reflection::Mirror
Defined in:
lib/abstract_reflection/mirror.rb

Overview

The basic mirror. This is the lib code. It is also the factory to use for creating new mirrors on any kind of object. Its #reflect class method will return an appropriate mirror for a given object, provided one has been registered. The [ObjectMirror] class should have been registered as the fallback case for any kind of object, but that may depend on the specific API implementation.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary (collapse)

Methods included from ClassMethods

included, mirror_class, reflect, reflect!, reflects?, register_mirror

Instance Method Details

- (Mirror) initialize(obj)

Returns a new instance of Mirror

Returns:

  • (Mirror)

    a new instance of Mirror



75
76
77
# File 'lib/abstract_reflection/mirror.rb', line 75

def initialize(obj)
  @subject = obj
end

- (Object) name

A generic representation of the object under observation.



80
81
82
# File 'lib/abstract_reflection/mirror.rb', line 80

def name
  @subject.inspect
end