lib/winrm/psrp/uuid.rb in winrm-2.2.3 vs lib/winrm/psrp/uuid.rb in winrm-2.3.0
- old
+ new
@@ -1,7 +1,5 @@
-# encoding: UTF-8
-#
# Copyright 2016 Shawn Neal <sneal@sneal.net>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -30,9 +28,10 @@
#
# @param uuid [String] Canonical hex format with hypens.
# @return [Array<byte>] UUID in a Windows GUID compatible byte array layout.
def uuid_to_windows_guid_bytes(uuid)
return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] unless uuid
+
b = uuid.scan(/[0-9a-fA-F]{2}/).map { |x| x.to_i(16) }
b[0..3].reverse + b[4..5].reverse + b[6..7].reverse + b[8..15]
end
end
end