Michael Guterl wrote:
> I have a class with a lot of instance methods which are related to
> class methods from within the same class.
> 
> Example:
> 
> <snip />
> 
> Everything works as expected.  However, I am wondering if there is a
> more Rubyish way of accomplishing this so I can avoid the repetition.
> Any other suggestions are welcome.  Thanks in advance.

The simplest thing would be to eliminate these calls on
the instances completely since no instance data is needed.

If you do want to do this, you can automate it by creating
a #method_missing handler for the instance methods--it will
check whether a class method by the same name exists and
then forward to it (falling back on the normal #method_missing
on failure).

> Michael Guterl


-- 
Posted via http://www.ruby-forum.com/.