One small problem, DbC doesn't check the invariant after the constructor,
although dbc.rb line 274 says it should.
require 'DbC'
class Test
def initialize
@n = 25
end
def invariant
@n == 10
end
end
begin
t = Test.new
rescue
puts "Exception thrown, good"
else
puts "No exception thrown, bad"
end
test.rb doesn't appear to test for this. I would fix it, but I'm still to
green in Ruby.
Regards,
JJ
--
Be Kind, Be Careful, Be Yourself
--
Solid, reliable software at reasonable prices
http://www.johnjohnsonsoftware.com
> > > Any interest/thoughts on implementing simple design
> > > by contract in Ruby?
> > You might want to check out Andy Hunt's
> > implementation:
> > http://www.pragmaticprogrammer.com/ruby/downloads/dbc.html
> >
> > Chad