Sha256: 769f2bd88cc9392bda1831434dd3aeab163047c8f4cf431a091ddeca7374c6c4

Contents?: true

Size: 386 Bytes

Versions: 10

Compression:

Stored size: 386 Bytes

Contents

class Module

  # Create an abstract method. If it is not overridden, it will
  # raise a TypeError when called.
  #
  #   class C
  #     abstract :a
  #   end
  #
  #   c = C.new
  #   c.a  #=> Error: undefined abstraction #a
  #
  # CREDIT: Trans

  def abstract( *sym )
    sym.each { |s|
      define_method( s ) { raise TypeError, "undefined abstraction ##{s}" }
    }
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/module/abstract.rb
facets-2.8.3 lib/core/facets/module/abstract.rb
facets-2.8.2 lib/core/facets/module/abstract.rb
facets-2.8.1 lib/core/facets/module/abstract.rb
facets-2.8.0 lib/core/facets/module/abstract.rb
facets-2.7.0 lib/core/facets/module/abstract.rb
facets-2.6.0 lib/core/facets/module/abstract.rb
facets-2.5.1 lib/core/facets/module/abstract.rb
facets-2.5.0 lib/core/facets/module/abstract.rb
facets-2.5.2 lib/core/facets/module/abstract.rb