Ruby (programming language)
Matsumoto defined it this way in an interview:Ruby is object-oriented: every value is an object, including classes and instances of types that many other languages designate as primitives (such as integers, booleans, and "null"). Variables always hold references to objects. Every function is a method and methods are always called on an object. Methods defined at the top level scope become methods of the Object class. Since this class is an ancestor of every other class, such methods can be called on any object. They are also visible in all scopes, effectively serving as "global" procedures. Ruby supports inheritance with dynamic dispatch, mixins and singleton methods (belonging to, and defined for, a single instance rather than being defined on the class). Though Ruby does not support multiple inheritance, classes can import modules as mixins.
Ruby (programming language)
The following code defines a class named codice_26. In addition to codice_27, the usual constructor to create new objects, it has two methods: one to override the codice_28 comparison operator (so codice_29 can sort by age) and the other to override the codice_30 method (so codice_31 can format its output). Here, codice_12 is an example of metaprogramming in Ruby: codice_33 defines getter and setter methods of instance variables, but codice_12 only getter methods. The last evaluated statement in a method is its return value, allowing the omission of an explicit codice_35 statement.