#-- # Copyright (C) 2006 Dimitrij Denissenko # Please read LICENSE document for more information. #++ module Retrospectiva module Inflector extend self def web_safe_short_name(long_name_or_caption_string) result = long_name_or_caption_string.dup.downcase result.gsub!(/['"]/, '') # replace quotes by nothing result.gsub!(/\W/, ' ') # strip all non word chars result.gsub!(/\ +/, '-') # replace all white space sections with a dash result.gsub!(/-{2,}/, '-') # trim multiple dashes result.gsub!(/(-)$/, '') # trim dashes result.gsub!(/^(-)/, '') result end end end RetroInflector = Retrospectiva::Inflector