Class: Mirrors::ConstantMirror
Instance Attribute Summary
Attributes inherited from FieldMirror
#name
Instance Method Summary
collapse
Methods inherited from FieldMirror
#defining_class, #initialize
Methods inherited from Mirror
#initialize, #mirrors?, #name, #reflectee, #subject_id
Instance Method Details
#delete ⇒ Object
30
31
32
|
# File 'lib/mirrors/field_mirror/constant_mirror.rb', line 30
def delete
@object.send(:remove_const, @name)
end
|
#private? ⇒ Boolean
26
27
28
|
# File 'lib/mirrors/field_mirror/constant_mirror.rb', line 26
def private?
false
end
|
#protected? ⇒ Boolean
22
23
24
|
# File 'lib/mirrors/field_mirror/constant_mirror.rb', line 22
def protected?
false
end
|
#public? ⇒ Boolean
18
19
20
|
# File 'lib/mirrors/field_mirror/constant_mirror.rb', line 18
def public?
true
end
|
#value ⇒ Object
3
4
5
6
7
8
9
10
11
12
|
# File 'lib/mirrors/field_mirror/constant_mirror.rb', line 3
def value
if path = @object.autoload?(@name)
unless $LOADED_FEATURES.include?(path) ||
$LOADED_FEATURES.include?(File.expand_path(path))
return nil
end
end
Mirrors.reflect @object.const_get(@name)
end
|
#value=(o) ⇒ Object
14
15
16
|
# File 'lib/mirrors/field_mirror/constant_mirror.rb', line 14
def value=(o)
@object.const_set(@name, o)
end
|