Project

meld

0.0
No release in over 3 years
Low commit activity in last 3 years
Utility library for combining objects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.1.1
~> 2.0.0
~> 10.5.0
~> 3.4.0
~> 0.36.0
 Project Readme

meld

Gem Version GitHub Workflow Status MIT Licensed

Utility library for combining objects

Usage

Deep hash merge -- .deep_merge

This will merge nested hashes:

require 'meld/hash/deep_merge'

a = { x: 4, y: { dogs: 3, cats: 5 }, z: { pizza: 10 } }
b = { y: { dogs: 6, fish: 2 } }
c = a.deep_merge(b)
p c
# {:x=>4, :y=>{:dogs=>6, :cats=>5, :fish=>2}, :z=>{:pizza=>10}}

a.deep_merge! b
p a
# {:x=>4, :y=>{:dogs=>6, :cats=>5, :fish=>2}, :z=>{:pizza=>10}}

Credit for the method goes to this StackOverflow answer

Installation

gem install meld

License

meld is released under the MIT License. See the bundled LICENSE file for details.