This project is read-only.


The convertors are special methods that exist in built-in types and can be defined in user types. There are three convertors altogether.


Must return a boolean.
Defining this method allows using the object in the condition and loop statements.


Must return an integer.


Must return a string.
This method is used by the Print Operator when you pass an object of the user type to it.

Convertor-like methods

You can possibly define your own convertor methods, following the to_* scheme. For example, the Range type contains a to_a method that converts the range to an array. Their return types, however, will not be enforced by the compiler.

Last edited Mar 17, 2011 at 12:31 AM by impworks, version 1


No comments yet.