Module: Unaccent
- Defined in:
- lib/unaccent.rb,
lib/unaccent/string.rb,
lib/unaccent/version.rb
Defined Under Namespace
Modules: String
Constant Summary collapse
- VERSION =
'0.3.0'
Class Method Summary collapse
-
.unaccent(str) ⇒ String
Replace a string’s accented characters with unaccented characters.
Class Method Details
.unaccent(str) ⇒ String
Replace a string’s accented characters with unaccented characters.
17 18 19 20 21 |
# File 'lib/unaccent.rb', line 17 def unaccent(str) return str if str.ascii_only? str.gsub(/[^[:ascii:]]/) { |char| ACCENTMAP.fetch(char, char) } end |