Skip to content

Instantly share code, notes, and snippets.

@Pegolon
Last active March 29, 2019 12:52
Show Gist options
  • Save Pegolon/ffbcef3509b8852cbc70e69f2031663e to your computer and use it in GitHub Desktop.
Save Pegolon/ffbcef3509b8852cbc70e69f2031663e to your computer and use it in GitHub Desktop.
Convert XML to YAML
require 'active_support/core_ext/hash/conversions'
require 'yaml'
source_file_path='/path/to/file.xml'
target_file_path='/path/to/file.yaml'
File.write(target_file_path, Hash.from_xml(File.read(source_file_path)).to_yaml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment