Contracts

There is no reason you couldn’t define a Ruby DSL or library (or even test harness) to assert or enforce “contracts”, method signatures, responds, whatever. All I could find so far, are these:

  • handshake: Handshake is an informal design-by-contract system written in pure Ruby. It‘s intended to allow Ruby developers to apply simple, clear constraints to their methods and classes.
  • ruby-contract: Represents a contract between Objects as a collection of test cases. Objects are said to fulfill a contract if all test cases suceed.

I don’t think I have an opinion yet. When would you really need something like this?

Tags:

Leave a Reply