Sha256: a4c587ba8569101c381714177fd3fe2241a8a4c3bb7fbb7bd72b81bff493b9be
Contents?: true
Size: 608 Bytes
Versions: 10
Compression:
Stored size: 608 Bytes
Contents
module Exlibris module Aleph # # If a class is abstract, it can't be instantiated. # module Abstract def self.included(klass) klass.class_eval do extend ClassAttributes end end module ClassAttributes def abstract @abstract ||= false end alias :abstract? :abstract attr_writer :abstract protected :abstract= end def initialize *args raise NotImplementedError.new("Cannot instantiate #{self.class.name}. It is abstract") if self.class.abstract? end end end end
Version data entries
10 entries across 10 versions & 1 rubygems