Michael Strelnikov wrote:
> Hello all,
> 
>   Does Ruby have something like "#define" for C/C++? Especially with
> arguments like "#define foo(x) (something_done_with_x(x))".
> 
>   Please don't say that "def" do the same. It doesn't.

The closest analogue is to conditionally define a constant, then used 
defined? on that constant.

For example, I do something like this in the windows-pr project, where 
some methods are not supported by Win2k or earlier:

module Windows
   module Console
     begin
       AttachConsole = Win32API.new('kernel32','AttachConsole','L', 'I')
     rescue LoadError
       # Requires Windows XP or later
     end
   end
end

And then, while using the above module:

class MyConsoleClass
    include Windows::Console

    def test
       if defined? AttachConsole
          # do something
       else
          # do something else
       end
    end
end

Regards,

Dan