Sha256: 954d99743b04f3520e3f1725568ca4afb6ac81f3cc9a643d886ad70c5f64e217
Contents?: true
Size: 522 Bytes
Versions: 10
Compression:
Stored size: 522 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 RubyRailsExtensions.presence(other_val) || this_val end end end # @see #merge! def nmerge(other_hash, &block) dup.nmerge!(other_hash, &block) end end
Version data entries
10 entries across 10 versions & 1 rubygems