Project

General

Profile

Feature #14347 » 0001-Add-more-documentation-for-Symbol-class.patch

jeremyevans0 (Jeremy Evans), 01/10/2018 03:03 AM

View differences:

string.c
/**********************************************************************
* Document-class: Symbol
*
* <code>Symbol</code> objects represent names and some strings
* <code>Symbol</code> objects represent named identifiers
* inside the Ruby
* interpreter. They are generated using the <code>:name</code> and
* <code>:"string"</code> literals
......
* $f2.object_id #=> 2514190
* $f3.object_id #=> 2514190
*
* Constant, method, and variable names are returned as symbols:
*
* module One
* Two = 2
* def three; 3 end
* @four = 4
* @@five = 5
* $six = 6
* end
* seven = 7
*
* One.constants
* # => [:Two]
* One.instance_methods(true)
* # => [:three]
* One.instance_variables
* # => [:@four]
* One.class_variables
* # => [:@@five]
* global_variables.last
* # => :$six
* local_variables
* # => [:seven]
*
* Symbol objects are different from String objects in that
* Symbol objects represent identifiers, while String objects
* represent text or data.
*/
(1-1/2)