> -----Original Message-----
> From: dave / thomases.com [mailto:dave / thomases.com]On Behalf Of Dave Thomas
> Sent: Tuesday, February 27, 2001 7:18 AM
> To: ruby-talk ML; ruby-talk / netlab.co.jp
> Subject: [ruby-talk:11649] Re: assert() library in Ruby?
>
> Eric Sven Ristad <ristad / mnemonic.com> writes:
>
> > How can I achieve the effect of the assert() macro from C in Ruby?
/skipped/

>   DEBUG = false  # or true
>
>   def assert
>     if DEBUG
>       result = yield
>       raise "Assertion failed" if !result
>     end
>   end
def assert
	raise 'assertion failed' unless yield if DEBUG
end



Aristarkh A Zagorodnikov, Lead Programmer, W3D Group
http://www.w3d.ru /// xm / w3d.ru /// ICQ UIN 36987938