Module: Veritas::AbstractClass::ClassMethods

Defined in:
lib/veritas/support/abstract_class.rb

Instance Method Summary collapse

Instance Method Details

#newObject

Instantiate a new object

Ensures that the instance cannot be of the abstract class and must be a descendant.

Examples:

object = AbstractClass.new

Returns:

  • (Object)


33
34
35
36
37
38
39
# File 'lib/veritas/support/abstract_class.rb', line 33

def new(*)
  if superclass.equal?(Object)
    raise NotImplementedError, "#{self} is an abstract class"
  else
    super
  end
end