method
const_set

const_set(p1, p2)
public
Register or
log in
to add new notes.
brian -
August 13, 2009
rafaelss -
November 9, 2009

0 thanks

0 thanks
overwrite
Replacing old value with new one
>> Module.const_set('MY_CONSTANT', 'value') => "value" >> Module::MY_CONSTANT => "value" >> Module.const_set('MY_CONSTANT', 'new value') (irb):3: warning: already initialized constant MY_CONSTANT => "new value" >> Module::MY_CONSTANT => "new value"
or
>> Kernel.const_set('MY_CONSTANT', 'value') => "value" >> MY_CONSTANT => "value" >> Kernel.const_set('MY_CONSTANT', 'new value') (irb):3: warning: already initialized constant MY_CONSTANT => "new value" >> MY_CONSTANT => "new value"