CHANGE transami@gmail.com - removed freeze from id2name
Generate a unique symbol.
Symbol.generate => :<1>
If suffix is given the new symbol will be suffixed with it.
Symbol.generate(:this) => :<2>this
Converts a symbol to camelcase. By default capitalization occurs on whitespace and underscores. By setting the first parameter to true the first character can also be captizlized. The second parameter can be assigned a valid Regualr Expression characeter set to determine which characters to match for capitalizing subsequent parts of the symbol.
:this_is_a_test.camelcase #=> :ThisIsATest :this_is_a_test.camelcase(false) #=> :thisIsATest
Successor method for symobol. This simply converts the symbol to a string uses String#succ and then converts it back to a symbol.
:a.succ => :b
Get a constant by a given symbol name.
:Class.to_const #=> Class
Note this method is not as verstile as it should be, since it can not access contants relative to the current execution context. But without a binding_of_caller that does not seem possible.
Symbol‘s really are just simplified strings. Thus to_str seems quite reasonable. This uses the Kernal#String method.