My apologies for answering myself, but I've discovered that
if __FILE__ == $0 and caller(0).size == 1
does what I want.

More elegant suggestions remain welcome of course.

Cheers,

Han Holl

On 5/24/05, Han Holl <han.holl / gmail.com> wrote:
> Hello,
> 
> As recommended in the pickaxe I often have a section at the end of a
> .rb file with
> if __FILE__ == $0
> ....
> end
> 
> However, if one of the included files includes this file itself (not
> unlikely at all), the code gets executed twice.
> Is there a reasonable workaround for this ?
> 
> Cheers,
> 
> Han Holl
>