You can wrap in if statement around any require. Try this:
if RUBY_PLATFORM =~ /mswin32/ # Matches win32 string in RUBY_PLATFORM
constant
require ''win32ole''
end
Of course, you''ll need similar code around any place where you actually
use
the Windows specific stuff.
On 5/4/06, Jodi Showers <jodi@nnovation.ca> wrote:>
> Greetings all.
>
> I have some controller code that uses win32ole (only available on
> windows). This code is now solid, and I''d now like to resume
> development on (any) other OS(grin).
>
> But alas, the controller bails because the OS specific library
can''t
> be found.
>
> Can I conditionally specify action code compilation (and a require
> ''win32ole'') based on OS or maybe an environment variable?
> (I''m thinking C #IFDEFs)
>
> Or perhaps an empty stub win32ole library for OSX/Linux?
>
> Thanks for your thoughts.
>
> Cheers,
> Jodi
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060504/42fac2a7/attachment-0001.html