class Qwik::Filename

Constants

ALLOWABLE_CHARACTERS_FOR_PATH_RE
ALLOWABLE_CHARACTERS_RE

Public Class Methods

allowable_characters_for_path?(f) click to toggle source
# File vendor/qwik/lib/qwik/util-filename.rb, line 44
def self.allowable_characters_for_path?(f)
  return true if ALLOWABLE_CHARACTERS_FOR_PATH_RE =~ f
  return false
end
contain_multibyte?(filename) click to toggle source
# File vendor/qwik/lib/qwik/util-filename.rb, line 29
def self.contain_multibyte?(filename)
  filename.each_byte {|byte|
    if 0x7f < byte || byte == ?\e
      return true
    end
  }
  return false
end
decode(str) click to toggle source
# File vendor/qwik/lib/qwik/util-filename.rb, line 21
def self.decode(str)
  str = str.gsub(/((?:=[0-9a-fA-F]{2})+)/) {
    [$1.delete('=')].pack('H*')
  }
  str = str.to_filename_charset
  return str
end
encode(str) click to toggle source
# File vendor/qwik/lib/qwik/util-filename.rb, line 13
def self.encode(str)
  str = str.to_filename_charset
  str = str.gsub(/([^ 0-9A-Za-z_.\/-]+)/) {
    '=' + $1.unpack('H2' * $1.size).join('=').upcase
  }
  return str
end
extname(filename) click to toggle source
# File vendor/qwik/lib/qwik/util-filename.rb, line 38
def self.extname(filename)
  return File.extname(filename).sub(/\A\./, '')
end

Private Class Methods

allowable_characters?(f) click to toggle source
# File vendor/qwik/lib/qwik/util-filename.rb, line 53
def self.allowable_characters?(f)
  return true if ALLOWABLE_CHARACTERS_RE =~ f
  return false
end