Class: Wiris::Reflect

Inherits:
Object
  • Object
show all
Defined in:
lib/src-generic/Reflect.rb

Class Method Summary collapse

Class Method Details

.field(obj, field) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/src-generic/Reflect.rb', line 3

def self.field(obj, field)
begin
    cls = Module::const_get(obj.name)
    return cls.class_variable_get(("@@" + field).to_sym)
end
rescue NameError
    return nil
end

.setField(obj, field, value) ⇒ Object



12
13
14
15
# File 'lib/src-generic/Reflect.rb', line 12

def self.setField(obj, field, value)
	cls = Module::const_get(obj.name)
	cls.class_variable_set(("@@" + field), value)
end