#!/usr/bin/ruby

#
## http://rosettacode.org/wiki/Classes
#

class MyClass(instance_var=1) {
    method add(Number num) {
        instance_var += num;
    }
}
 
var obj = MyClass(3);   # `instance_var` will be set to 3
obj.add(5);             # calls the add() method
say obj.instance_var;   # prints the value of `instance_var`: 8
