Class: Picky::CharacterSubstituters::Polish

Inherits:
Base
  • Object
show all
Defined in:
lib/picky/character_substituters/polish.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_s

Constructor Details

This class inherits a constructor from Picky::CharacterSubstituters::Base

Instance Method Details

#substitute(text) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/picky/character_substituters/polish.rb', line 9

def substitute text
  trans = @chars.new(text).normalize :kd

  trans.gsub! 'Ł', 'L'
  trans.gsub! 'ł', 'l'

  trans.unpack('U*').select { |cp|
    cp < 0x0300 || cp > 0x035F
  }.pack 'U*'
end