Logan Capaldo
3/9/2006 1:55:00 AM
On Mar 8, 2006, at 8:35 PM, Paatsch, Bernd wrote:
>
> Hello,
>
> I just started using catch and throw. Therefore this question might
> be an
> easy one.
>
> I have multiple ruby files. In one of the files I like to throw and
> then in
> the main function in a different file I like to catch the throw.
> Is this
> possible or do throw/catch need to be in the same file?
>
>
> Example:
> fileOne.rb
>
> def somefunct
> ....
> throw :quit_script
> ....
> end
>
> fileTwo.rb
> catch :quit_script
> ...
> end
>
> Thx,
> Bernd
They have to be in the same call chain.
so if fileTwo require's fileOne.rb and fileTwo's code looks like
catch :quit_script do
...
somefunct()
...
end
it will work