Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby
tag: v0.0.6

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
lib
spec
.gitignore
.rspec
.ruby-gemset
.travis.yml
CONTRIBUTING.md
Gemfile
Gemfile.devtools
Guardfile
LICENSE
README.md
Rakefile
TODO
abstract_type.gemspec

README.md

abstract_type

Gem Version Build Status Dependency Status Code Climate Coverage Status

This is a small standalone gem featuring a module ripped out from axiom. It allows to declare abstract_type classes and modules in an unobstrusive way.

Installation

With Rubygems:

$ gem install abstract_type
$ irb -rubygems
>> require 'abstract_type'
=> true

With git and local working copy:

$ git clone git://github.com/dkubb/abstract_type.git
$ cd abstract_type
$ rake install
$ irb -rubygems
>> require 'abstract_type'
=> true

Examples

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

Contributing

See CONTRIBUTING.md for details.

Copyright

Copyright © 2009-2013 Dan Kubb. See LICENSE for details.

Something went wrong with that request. Please try again.