class TextHyphenRails::Hyphenator

Public Class Methods

new(text, lang, options) click to toggle source
# File lib/text_hyphen_rails/hyphenator.rb, line 5
def initialize(text, lang, options)
  @opts = options
  @lang = lang
end

Private Instance Methods

hyphenator() click to toggle source
# File lib/text_hyphen_rails/hyphenator.rb, line 17
def hyphenator
  @hyph ||= ::Text::Hyphen.new(language: @lang,
                               left: @opts[:left],
                               right: @opts[:right])
end
regex() click to toggle source
# File lib/text_hyphen_rails/hyphenator.rb, line 12
def regex
  n = @opts[:min_word_length]
  @rx ||= Regexp.new("[[:alpha:]]{#{n},}")
end