Sha256: 8ea868220cbfd193f8bafc9d1da3be9f4e39af3aa5af2ac2bd437ebbf82771cf

Contents?: true

Size: 387 Bytes

Versions: 7

Compression:

Stored size: 387 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

7 entries across 7 versions & 2 rubygems

Version Path
facets-2.4.0 lib/facets/module/abstract.rb
facets-2.4.1 lib/facets/module/abstract.rb
facets-2.4.2 lib/core/facets/module/abstract.rb
facets-2.4.3 lib/core/facets/module/abstract.rb
facets-2.4.4 lib/core/facets/module/abstract.rb
facets-2.4.5 lib/core/facets/module/abstract.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/module/abstract.rb