Module Abstract
In: lib/abstract.rb

When this module is included into a class, this class can‘t be instantiate any more until the Concrete module is included too. This module cannot be included if the Concrete module has been included before in one of the class’ superclass.

Methods

included   new  

Public Class methods

[Source]

# File lib/abstract.rb, line 19
  def self.included(klass)
    super
    if klass.include?(Concrete)
      raise(TypeError, "#{klass} - cannot make abstract a concrete class")
    end
    klass.module_eval do
      class << self
        unless private_method_defined?(:concrete_new)
          alias_method :concrete_new, :new
          visibility = instance_method_visibility('new')
          def new(*args, &block)
            raise(TypeError, "cannot instantiate an abstract class #{name}")
          end
          send(visibility, :new)
          private :concrete_new
        end
      end
    end
  end

[Source]

# File lib/abstract.rb, line 29
          def new(*args, &block)
            raise(TypeError, "cannot instantiate an abstract class #{name}")
          end

[Validate]