Class: NormalizeXMLTask

Inherits:
Object
  • Object
show all
Defined in:
lib/normalizexml/normalize_xml_task.rb

Class Method Summary collapse

Class Method Details

.normalize_file(srcfile, output_dir, verbose = false) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/normalizexml/normalize_xml_task.rb', line 15

def self.normalize_file(srcfile, output_dir, verbose = false)
  out_dir = Pathname.new output_dir
  out_file = Pathname.new(srcfile).basename.sub_ext('.nml.xml')
  out_path = out_dir + out_file
  out_dir.mkpath unless out_dir.exist?
  FileUtils.cp srcfile, out_path

  parser = NormalizeXml::Parser.new
  parser.infile = srcfile
  parser.outfile = out_path.to_s
  parser.verbose = verbose
  parser.normalize()
end