Modules and functions
From Reia
Modules
Modules contain groups of functions:
>> module Foo .. def bar() .. 40 .. end .. def baz(n) .. n + 2 .. end .. end => Foo >> Foo.baz(Foo.bar()) => 42
Functions
Functions belong to modules. Unlike methods, functions are pure and free of side effects.
Functions can be called using module.func form (see above)
Obtaining references to functions
- Note: not implemented at this time, sorry
Omit the parens after applying a function to obtain a reference to it in the form of a lambda:
>> module Foo .. def plustwo(n) .. n + 2 .. end .. end => Foo >> ref = Foo.plustwo => #<Lambda Foo:plustwo> >> ref(40) => 42

