Skip to content

Instantly share code, notes, and snippets.

@jonasporto
Created March 16, 2016 12:22
Show Gist options
  • Save jonasporto/b6ace2f0fe84713c4924 to your computer and use it in GitHub Desktop.
Save jonasporto/b6ace2f0fe84713c4924 to your computer and use it in GitHub Desktop.
Ruby Merge Hash Sum Non String Values
.inject{|a, b|
a.merge(b){ |_, x, y| x.is_a?(String) && x.eql?(y) ? x : x + y
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment