Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/pathname2.rb,
lib/pathname2.rb

Direct Known Subclasses

Pathname

Instance Method Summary collapse

Instance Method Details

#to_pathObject

Convert a string directly into a Pathname object.



1122
1123
1124
# File 'lib/pathname2.rb', line 1122

def to_path
  Pathname.new(self)
end

#wincodeObject

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



39
40
41
42
43
44
# File 'lib/pathname2.rb', line 39

def wincode
  if self.encoding.name != 'UTF-16LE'
    temp = self.dup
    (temp.tr(File::SEPARATOR, File::ALT_SEPARATOR) << 0.chr).encode('UTF-16LE')
  end
end