Class: Ruby::Reflection::ConstantMirror
Instance Attribute Summary
#reflection
Instance Method Summary
collapse
Methods inherited from FieldMirror
#initialize, mirror_class, #name
#writable?
#initialize, #mirrors?, #name, #reflectee
#included, #mirror_class, #new, #reflect, #reflect!, #reflects?, #register_mirror
Instance Method Details
31
32
33
|
# File 'lib/ruby/reflection/field_mirror/constant_mirror.rb', line 31
def delete
@object.send(:remove_const, @name)
end
|
#private? ⇒ Boolean
27
28
29
|
# File 'lib/ruby/reflection/field_mirror/constant_mirror.rb', line 27
def private?
false
end
|
#protected? ⇒ Boolean
23
24
25
|
# File 'lib/ruby/reflection/field_mirror/constant_mirror.rb', line 23
def protected?
false
end
|
#public? ⇒ Boolean
19
20
21
|
# File 'lib/ruby/reflection/field_mirror/constant_mirror.rb', line 19
def public?
true
end
|
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/ruby/reflection/field_mirror/constant_mirror.rb', line 4
def value
if path = @object.autoload?(@name)
unless $LOADED_FEATURES.include?(path) ||
$LOADED_FEATURES.include?(File.expand_path(path))
return nil
end
end
reflection.reflect @object.const_get(@name)
end
|
#value=(o) ⇒ Object
15
16
17
|
# File 'lib/ruby/reflection/field_mirror/constant_mirror.rb', line 15
def value=(o)
@object.const_set(@name, o)
end
|