class ShellSanitizer

Constants

REPLACE_HASH

Public Class Methods

clean_path(path) click to toggle source
# File lib/luigi/ShellSanitizer.rb, line 33
def self.clean_path(path)
  path = path.strip()
  path = deumlautify path
  path.sub!(/^\./,'') # removes hidden_file_dot '.' from the begging
  path.gsub!(/\//,'_')
  path.gsub!(/\//,'_')
  return path
end
deumlautify(string) click to toggle source

TODO somebody find me a gem that works and I'll replace this

# File lib/luigi/ShellSanitizer.rb, line 26
def self.deumlautify(string)
  string = string.dup
  REPLACE_HASH.each{|k,v| string = string.force_encoding("UTF-8").gsub k, v }
  string.each_char.to_a.keep_if {|c| c.ascii_only?}
  return string
end
process(string) click to toggle source
# File lib/luigi/ShellSanitizer.rb, line 19
def self.process(string)
  string = deumlautify string
  #string = Ascii.process string
  return string
end