Sha256: cb8dd0ee14643024a05df57c3d12a03b9a6bd756255e85f2d7e18d7108f0c166
Contents?: true
Size: 501 Bytes
Versions: 8
Compression:
Stored size: 501 Bytes
Contents
# frozen_string_literal: true Hash.class_eval do # Does a typical merge, but this will remove blank values on the right side. # # @param other_hash [Hash] # # @return [Hash] # def nmerge!(other_hash) merge!(other_hash) do |key, this_val, other_val| if block_given? yield(key, this_val, other_val) else other_val.presence || this_val end end end # @see #merge! def nmerge(other_hash, &block) dup.nmerge!(other_hash, &block) end end
Version data entries
8 entries across 8 versions & 1 rubygems