Class: Hyphenator
Constant Summary collapse
- ACCENTED_CHARS =
/[çãâäõáéíóúêôàü]/
Instance Method Summary collapse
- #hyphenate(word) ⇒ Object
-
#initialize ⇒ Hyphenator
constructor
A new instance of Hyphenator.
Constructor Details
#initialize ⇒ Hyphenator
Returns a new instance of Hyphenator.
8 9 10 11 12 13 14 15 16 |
# File 'lib/hyphenator.rb', line 8 def initialize @hyphenator = Text::Hyphen.new do |h| h.left = 0 h.right = 0 h.language = 'pt' end @orig_accented_chars_pos = Hash.new end |
Instance Method Details
#hyphenate(word) ⇒ Object
18 19 20 21 22 |
# File 'lib/hyphenator.rb', line 18 def hyphenate(word) word = remove_accents word hyphenated_raw = @hyphenator.visualize word hyphenated_final = put_accents_back word, hyphenated_raw end |