On 6/23/07, Robert Dober <robert.dober / gmail.com> wrote:
> On 6/23/07, Gregory Brown <gregory.t.brown / gmail.com> wrote:
> And to round up the picture and to keep David happy ;)
>
> --------------------- 8< ------------------
> module M
>    def my_fancy_method
>    ...
> ...
>
> class C
>    extend M
> ...
>
> C.my_fancy_method
> --------------------- >8 -------------------
>
> this might indeed be a useful pattern which is underused - citation David Black.

sure. It's fairly OT from what was asked for though, but while we're here

I rarely find myself needing 'just' class methods, and I don't like
doing a seperate call to mix them in, so i'd typically do something
like

module M

  module ClassMethods
      def whatever; end
  end

  def self.included(base)
     base.extend(ClassMethods)
  end

end

class C
   include M
end

But if all you need is the class methods, and don't mind using extend,
what you suggested works fine.