Class: Nestene::FileNameConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/nestene/storage.rb

Instance Method Summary collapse

Instance Method Details

#file_name_to_key(file_name) ⇒ Object



12
13
14
# File 'lib/nestene/storage.rb', line 12

def file_name_to_key file_name
  file_name.gsub(/_[a-zA-Z0-9]{2}/){|x| x[1..-1].hex.chr}
end

#key_to_file_name(key) ⇒ Object



8
9
10
# File 'lib/nestene/storage.rb', line 8

def key_to_file_name(key)
  key.gsub(/[^a-zA-Z0-9]/){|x| "_%x" % x.ord}
end