Why?
Just create a method that does this good for once and for all and just call that method from everywhere in your code…
# somewhere in constants.rb f.e.
# OSX vs WINDOWS
PLATFORM_IS_OSX = ((Object::RUBY_PLATFORM =~ /darwin/i) ? true : false).freeze()
PLATFORM_IS_WINDOWS = (!PLATFORM_IS_OSX).freeze()
# somewhere in utils.rb f.e.
def open_external(path)
# do replace on windows
path= path.gsub("/", "\\\\") if PLATFORM_IS_WINDOWS
# construct the command to open Explorer on Windows or Finder on OsX
command = PLATFORM_IS_WINDOWS ? "start \"\" \"#{path}\"" : "open \"#{path}\""
system(command)
end #def
# somewhere in your code
open_external("C:/users/") # this should work both for folders and files