I wrote a ruby file which can be used as a library. But in order to test it, I also write some test data.
For example:
class Checker
do some thing
end
# if this file is used as a library, I don't want following code executed
checker = Checker.new
checker.dosomething
I know there is a way to determine if the file is used as library or not, but I don't remember it now. It is like:
if ???=__FILE__
checker = Checker.new
checker.dosomething
end
Somebody knows? Thanks in advance