Class: Ruby::Reflection::FieldMirror
- Inherits:
-
Mirror
- Object
- Mirror
- Ruby::Reflection::FieldMirror
- Includes:
- AbstractReflection::FieldMirror
- Defined in:
- lib/ruby/reflection/field_mirror.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Field
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (FieldMirror) initialize(obj)
constructor
A new instance of FieldMirror.
- - (Object) name
Methods included from AbstractReflection::FieldMirror
#private?, #protected?, #public?, #value, #value=, #writable?
Methods included from AbstractReflection::Mirror::ClassMethods
#included, #mirror_class, #reflect, #reflect!, #reflects?, #register_mirror
Constructor Details
- (FieldMirror) initialize(obj)
A new instance of FieldMirror
21 22 23 24 25 |
# File 'lib/ruby/reflection/field_mirror.rb', line 21 def initialize(obj) super @object = obj.object @name = obj.name end |
Class Method Details
+ (Object) mirror_class(field)
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby/reflection/field_mirror.rb', line 8 def self.mirror_class(field) if reflects?(field) case when field.name.start_with?("@@") ClassVariableMirror when field.name.start_with?("@") InstanceVariableMirror else ConstantMirror end end end |
Instance Method Details
- (Object) name
27 28 29 |
# File 'lib/ruby/reflection/field_mirror.rb', line 27 def name @name end |