lib/picky/character_substituters/west_european.rb in picky-2.7.0 vs lib/picky/character_substituters/west_european.rb in picky-3.0.0.pre1
- old
+ new
@@ -1,37 +1,43 @@
# encoding: utf-8
#
-module CharacterSubstituters # :nodoc:all
- # Substitutes Umlauts like
- # ä, ö, ü => ae, oe, ue.
- # (and more, see specs)
- #
- class WestEuropean
+module Picky
- def initialize
- @chars = ActiveSupport::Multibyte.proxy_class
- end
+ module CharacterSubstituters # :nodoc:all
- def to_s
- self.class.name
- end
+ # Substitutes Umlauts like
+ # ä, ö, ü => ae, oe, ue.
+ # (and more, see specs)
+ #
+ class WestEuropean
- def substitute text
- trans = @chars.new(text).normalize(:kd)
+ def initialize
+ @chars = ActiveSupport::Multibyte.proxy_class
+ end
- # substitute special cases
- #
- trans.gsub!('ß', 'ss')
+ def to_s
+ self.class.name
+ end
- # substitute umlauts (of A,O,U,a,o,u)
- #
- trans.gsub!(/([AOUaou])\314\210/u, '\1e')
+ def substitute text
+ trans = @chars.new(text).normalize(:kd)
- # get rid of ecutes, graves and …
- #
- trans.unpack('U*').select { |cp|
- cp < 0x0300 || cp > 0x035F
- }.pack('U*')
+ # substitute special cases
+ #
+ trans.gsub!('ß', 'ss')
+
+ # substitute umlauts (of A,O,U,a,o,u)
+ #
+ trans.gsub!(/([AOUaou])\314\210/u, '\1e')
+
+ # get rid of ecutes, graves and …
+ #
+ trans.unpack('U*').select { |cp|
+ cp < 0x0300 || cp > 0x035F
+ }.pack('U*')
+ end
+
end
end
+
end
\ No newline at end of file