On 6/16/07, Eli Bendersky <eliben / gmail.com> wrote:

> But if I want a class family adhering to an abstract interface (like
> the previous posts show), how can I do that with a Module ? Module
> doesn't allow the "private_class_method" line since it doesn't have
> a :new method. With an abstract base Class (instead of Module) it *is*
> possible, isn't it ?

module B

  def create
       new(20)
  end

end

class A

  extend B

  def initialize(foo)
     @foo = foo
  end

  def bar
      @foo + 10
  end
end

c = A.create
c.bar #=> 30