Method: Phonetic::Algorithm.encode
- Defined in:
- lib/phonetic/algorithm.rb
.encode(str, options = {}) ⇒ String
Generic method for encoding string. Splits string by words and encodes it with encode_word.
18 19 20 21 22 |
# File 'lib/phonetic/algorithm.rb', line 18 def self.encode(str, = {}) str.scan(/\p{Word}+/).map do |word| encode_word(word, ) end.compact.reject(&:empty?).join(' ') end |