module TextHyphenRails::TextHyphenEntension

Public Instance Methods

add_exception(exc) click to toggle source
# File lib/text_hyphen_rails/text_hyphen_extension.rb, line 3
def add_exception exc
  poss, off = [], 0
  exc.chars.each_with_index {|c, n| c == '-' && poss << n - off && off += 1}
  exc_arr = (0..exc.size-off).map {|i| poss.include?(i) ? 1 : 0}
  language.exceptions[exc.gsub('-', '')] = exc_arr
end