Skip to content

Instantly share code, notes, and snippets.

@jeremyf
Created November 3, 2016 16:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyf/d3f83d65fc7e61b27e34b84560f85367 to your computer and use it in GitHub Desktop.
Save jeremyf/d3f83d65fc7e61b27e34b84560f85367 to your computer and use it in GitHub Desktop.
deep_merge_two_yaml_files.rb
gem 'activesupport'
require 'active_support/core_ext/hash/deep_merge'
require 'psych'
first_hash = Psych.load_file(PATH_TO_FIRST_FILE)
second_hash = Psych.load_file(PATH_TO_SECOND_FILE)
File.write(PATH_TO_MERGED_FILE, Psych.dump(first_hash.deep_merge(second_hash)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment