1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# abstract_type
This is a small standalone gem featuring a module ripped out from [axiom](https://github.com/dkubb/axiom).
It allows to declare abstract_type classes and modules in an unobstrusive way.
[][gem]
[][travis]
[][gemnasium]
[][codeclimate]
[][coveralls]
[gem]: https://rubygems.org/gems/abstract_type
[travis]: https://travis-ci.org/dkubb/abstract_type
[gemnasium]: https://gemnasium.com/dkubb/abstract_type
[codeclimate]: https://codeclimate.com/github/dkubb/abstract_type
[coveralls]: https://coveralls.io/r/dkubb/abstract_type
## Examples
``` ruby
class Foo
include AbstractType
# Declare abstract instance method
abstract_method :bar
# Declare abstract singleton method
abstract_singleton_method :baz
end
Foo.new # raises NotImplementedError: Foo is an abstract type
Foo.baz # raises NotImplementedError: Foo.baz is not implemented
# Subclassing to allow instantiation
class Baz < Foo; end
object = Baz.new
object.bar # raises NotImplementedError: Baz#bar is not implemented
```
## Credits
* Dan Kubb ([dkubb](https://github.com/dkubb))
* Markus Schirp ([mbj](https://github.com/mbj))
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
## Copyright
Copyright © 2009-2013 Dan Kubb. See LICENSE for details.
|