module DeepMerge::DeepMergeArray

inject this method into the Array class to add deep merging functionality to Arrays

Public Instance Methods

deep_merge(other) click to toggle source
# File lib/deepmerge.rb, line 10
def deep_merge(other)
  (self+other).uniq
end
deep_merge!(other) click to toggle source
# File lib/deepmerge.rb, line 14
def deep_merge!(other)
  # in ruby, uniq! returns nil if there are no changes unlike uniq which returns the array
  # because of this uniq has to be used here with a replacement instead of uniq!
  replace(concat(other).uniq)
end