R
Ronald Fischer
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"?
Ronald
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"?
Ronald