Class: CopybookUtils::ConvertFile

Inherits:
Object
  • Object
show all
Defined in:
lib/copybook_utils/convert_file.rb

Instance Method Summary collapse

Instance Method Details

#convert_file(conversion_method, copybook_xml, from_filename, to_filename) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/copybook_utils/convert_file.rb', line 5

def convert_file conversion_method, copybook_xml, from_filename, to_filename
    doc = Nokogiri.XML(copybook_xml)

    @conversion_method = conversion_method
    @record_fields = []
    flatten_xml 0, 0, doc.root.children
    record_length = @record_fields[-1][:start] + @record_fields[-1][:length]

    convert record_length, from_filename, to_filename
end