Sha256: 0aa842ed4e782f5022aa7062c73edd9941a3b08ac7bb2286fc4478508cc25bdb
Contents?: true
Size: 700 Bytes
Versions: 44
Compression:
Stored size: 700 Bytes
Contents
# encoding: utf-8 module Alchemy # Provides methods for converting names into urlnames and vice versa. # module NameConversions # Converts a given name into url save and readable urlanme. # Uses rails parameterize, but converts german umlauts before. # # @returns String def convert_to_urlname(name) name .gsub(/[äÄ]/, 'ae') .gsub(/[üÜ]/, 'ue') .gsub(/[öÖ]/, 'oe') .gsub(/[ß]/, 'ss') .parameterize end # Converts a filename and suffix into a human readable name. # def convert_to_humanized_name(name, suffix) name.gsub(/\.#{::Regexp.quote(suffix)}$/i, '').gsub(/_/, ' ').strip end end end
Version data entries
44 entries across 44 versions & 2 rubygems