Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/win32/file/windows/helper.rb

Instance Method Summary collapse

Instance Method Details

#read_wideObject

Read a wide character string up until the first double null, and delete any remaining null characters.



10
11
12
# File 'lib/win32/file/windows/helper.rb', line 10

def read_wide
  self[/^.*?(?=\x00{2})/].delete(0.chr)
end

#wincodeObject

Convenience method for converting strings to UTF-16LE for wide character functions that require it.



4
5
6
# File 'lib/win32/file/windows/helper.rb', line 4

def wincode
  (self.tr(File::SEPARATOR, File::ALT_SEPARATOR) + 0.chr).encode('UTF-16LE')
end