class ENVModule
  def ENVModule.module(*args)
    if args[0].kind_of?(Array) then
      args = args[0].join(' ')
    else
      args = args.join(' ')
    end
    ENV["__LMOD_PROTECTED_LD_LIBRARY_PATH"] = os.environ.get('LD_LIBRARY_PATH','')
    ENV["__LMOD_PROTECTED_LD_PRELOAD"]      = os.environ.get('LD_PRELOAD','')
    ENV["LD_LIBRARY_PATH"]                  = ''
    ENV["LD_PRELOAD"]                       = ''

    eval `/usr/share/lmod/lmod/libexec/lmod ruby --protected_vars #{args}`
    return true
  end
end
