类常量

    类常量

    A constant has a name starting with an uppercase character.

    常量的名称以大写字母开头。

    它应该最多赋值一次。

    In the current implementation of ruby, reassignment of a constant generates a warning but not an error (the non-ANSI version of eval.rb does not report the warning):

    Ruby的当前实现中,重新给一个常量赋值将产生一个警告,而不是一个错误(非ansi版本的eval.rb不报告警告):

    常量可能在类中被定义,但是不同于实例变量,它们可以在类外部被访问。

    Constants can also be defined in modules.

    常量同样可以在模块中被定义。