MESSAGE
DATE | 2014-09-02 |
FROM | Ruben Safir
|
SUBJECT | Re: [NYLXS - HANGOUT] Ruby groups
|
You have to love this
Ruby uses a convention that may seem strange at first: the first characters of a name indicate how the name is used. Local variables, method parameters, and method names should all start with a lowercase letter or with an underscore. Global variables are prefixed with a dollar sign ($), and instance variables begin with an “at” sign (-at-). Class variables start with two “at” signs (-at--at-). 2 Finally, class names, module names, and constants must start with an uppercase letter. Samples of different names are given in Table 2.1 on the next page. Following this initial character, a name can be any combination of letters, digits, and under- scores (with the proviso that the character following an -at- sign may not be a digit). How- ever, by convention, multiword instance variables are written with underscores between the words, and multiword class names are written in MixedCase (with each word capitalized). Method names may end with the characters ?, !, and =.
|
|