On Jan 24, 2008, at 10:23 AM, Ronald Fischer wrote:

> I found in "Ruby Cookbook" (recipe 8.8) a syntactically
> interesting construct, which I would like to understand.
> Here is the excerpt from the coding example:
>
> require 'delegate'
> class OrdinalNumber < DelegateClass(Fixnum)
>  ...
> end
>
> I am a bit puzzled about the way the parent class is
> written: DelegateClass(Fixnum). This looks like a
> function call, only that DelegateClass is not a
> function (since it starts with an upper-case letter).
> How does it work out that DelegateClass(Fixnum) evaluates
> to something of type "Class"?

It is a method call actually.  You are allowed to create method that  
begin with a capital letter, though it's best only used for special  
cases like this.  Usually a capitalized method does some kind of  
conversion, like what we see here or Kernel#Array, Kernel#String, etc.

James Edward Gray II