hacks/const_ref |
class ConstRef < Object |
Ruby's constants are like #1, above.
Ruby has frozen objects, but no built-in equivalent to #2. A Const_Ref is a reference to an object that freezes the object before calling methods on it, and unfreezes the object when the method returns (if the object was not already frozen before the method was called).
This is not quite the same as a pointer to a constant, but is similar. It differs in the following example:
This method call will fail in Ruby; it would have succeded in C.
Public Methods |