[MacRuby-devel] How to test if you're running MacRuby vs. Ruby?

Paul Howson paul-lists at tdgq.com.au
Fri Dec 18 12:14:55 PST 2009


On 17/12/2009, at 6:21 PM, Josh Ballanco wrote:

> def is_macruby?
>  defined? RUBY_ENGINE && RUBY_ENGINE == 'macruby'
> end
> 
> Cheers,
> Josh

Thanks Josh. However I note this works only if you write:

defined?(RUBY_ENGINE) && RUBY_ENGINE == 'macruby'

i.e. the argument to defined? must be put in parentheses else MacRuby crashes.

Paul Howson



More information about the MacRuby-devel mailing list