Class: EdifactConverter::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/edifact_converter/converter.rb

Instance Method Summary collapse

Instance Method Details

#convert(text, &proc) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/edifact_converter/converter.rb', line 9

def convert(text, &proc)
  self.error_proc = proc || Proc.new { |msg| STDERR.puts msg }
  xml = Nokogiri::XML(text)
  if xml.errors.empty?
    convert_xml(xml)
  else
    convert_edifact(text)
  end
end