Skip to content

Commit

Permalink
Oops, dead code. Thanks, Christoffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
henrik committed Aug 1, 2008
1 parent b8bc991 commit 96de351
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions slugalizer.rb
Expand Up @@ -19,25 +19,12 @@ def slugalize(text, word_separator = "-")
unless SEPARATORS.include?(word_separator)
raise "Word separator must be one of #{SEPARATORS}"
end
transliterate(text.to_s).
ActiveSupport::Multibyte::Handlers::UTF8Handler.normalize(text.to_s, :kd).
gsub(/[^\w\s\-\+]/n, "").
strip.
gsub(/(\s|#{Regexp.escape word_separator})+/, word_separator).
downcase
end

protected

def transliterate(text)
if defined?(ActiveSupport::Multibyte)
ActiveSupport::Multibyte::Handlers::UTF8Handler.normalize(text, :kd)
elsif defined?(Unicode)
Unicode.normalize_KD(text)
else
Iconv.iconv('ascii//translit//IGNORE', 'utf-8', text).to_s
end
end

end


Expand Down

0 comments on commit 96de351

Please sign in to comment.