Method: EdifactConverter::XML::Paragraph#divide_text

Defined in:
lib/edifact_converter/xml/paragraph.rb

#divide_text(value, &block) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/edifact_converter/xml/paragraph.rb', line 142

def divide_text(value, &block)
  chars = value.encode("iso-8859-1").chars
  text = StringIO.new
  text.set_encoding("iso-8859-1")
  chars = chars.reject do |c|
    if text.size == 69 and chars.count > 1
      text.string = insert_split(text, &block)
    end
    text.seek text.size
    text.write c
    true
  end
  text.string.encode "UTF-8"
end