Module: AbstractReflection::Mirror
- Extended by:
- ClassMethods
- Included in:
- CompilerMirror, FieldMirror, GCMirror, MethodMirror, ObjectMirror, StackFrameMirror, ThreadMirror, 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 Attribute Summary collapse
-
#reflection ⇒ Object
Returns the value of attribute reflection.
Instance Method Summary collapse
- #initialize(obj) ⇒ Object
-
#mirrors?(other) ⇒ Boolean
The equivalent to #==/#eql? for comparison of mirrors against objects.
-
#name ⇒ Object
A generic representation of the object under observation.
-
#reflectee ⇒ Object
Accessor to the reflected object.
Methods included from ClassMethods
included, mirror_class, new, reflect, reflect!, reflects?, register_mirror
Instance Attribute Details
#reflection ⇒ Object
Returns the value of attribute reflection.
87 88 89 |
# File 'lib/abstract_reflection/mirror.rb', line 87 def reflection @reflection end |
Instance Method Details
#initialize(obj) ⇒ Object
89 90 91 |
# File 'lib/abstract_reflection/mirror.rb', line 89 def initialize(obj) @subject = obj end |
#mirrors?(other) ⇒ Boolean
The equivalent to #==/#eql? for comparison of mirrors against objects
99 100 101 |
# File 'lib/abstract_reflection/mirror.rb', line 99 def mirrors?(other) @subject == other end |
#name ⇒ Object
A generic representation of the object under observation.
94 95 96 |
# File 'lib/abstract_reflection/mirror.rb', line 94 def name @subject.inspect end |
#reflectee ⇒ Object
Accessor to the reflected object
104 105 106 |
# File 'lib/abstract_reflection/mirror.rb', line 104 def reflectee @subject end |