lib/core/facets/module/abstract.rb in facets-2.8.4 vs lib/core/facets/module/abstract.rb in facets-2.9.0.pre.1
- old
+ new
@@ -1,21 +1,24 @@
class Module
# Create an abstract method. If it is not overridden, it will
# raise a TypeError when called.
#
- # class C
+ # class AbstractExample
# abstract :a
# end
#
- # c = C.new
- # c.a #=> Error: undefined abstraction #a
+ # c = AbstractExample.new
#
+ # expect TypeError do
+ # c.a
+ # end
+ #
# CREDIT: Trans
- def abstract( *sym )
- sym.each { |s|
- define_method( s ) { raise TypeError, "undefined abstraction ##{s}" }
- }
+ def abstract(*sym)
+ sym.each do |s|
+ define_method(s){ raise TypeError, "undefined abstraction ##{s}" }
+ end
end
end