I\'m trying to include the unit tests for a module in the same source file as the module itself, following the Perl modulino model.
#! /usr/bin/env ruby
req
Personally I've never heard of anyone trying to do this in Ruby. It's definitely not a standard practice. That said you may be able to leverage this trick:
if __FILE__ == $0
# Do something.. run tests, call a method, etc. We're direct.
end
The code in the if block will only execute if the file is executed directly, not if it's required by another library or application.
More ruby tricks here: http://www.rubyinside.com/21-ruby-tricks-902.html