unknown wrote:
> the one that springs to mind is
> 
>    module Mixin
>      def average
>        total.to_f / n.to_f
>      end
>      def total
>        raise NotImplementedError
>      end
>      def n
>        raise NotImplementedError
>      end
>    end
> 
> this give a much nicer error than NameError or something about nil not
> responding to 'to_f'.

module Mixin
  def average
    total().quo(n())
  end
end

a) uses Rational if possible ;-p (ok, besides the point)
b) no superfluous code
c) no additional exception

I'm sorry, I still fail to see the point in defining a method that says 
the method can't be executed (put a menu that isn't actually served on 
the menucard - put it on the menucard when it is served)

My regards

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