Реклама

Ruby – Class constants

A constant has a name starting with an uppercase character. It should be assigned a value at most once. 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): Constants may be defined within classes, but unlike instance…

Ruby – classes

The real world is filled by objects, and we can classify them. For example, a very small child is likely to say “bow-wow” when seeing a dog, regardless of the breed; we naturally see the world in terms of these categories. In OO programming terminology, a category of objects like “dog” is called a class,…
Advertisement