Module: DeepMerge::RailsCompat

Included in:
Hash
Defined in:
lib/deep_merge/rails_compat.rb

Instance Method Summary collapse

Instance Method Details

#deeper_merge(source, options = {}) ⇒ Object

deep_merge will merge and skip any unmergeables in destination hash



18
19
20
21
# File 'lib/deep_merge/rails_compat.rb', line 18

def deeper_merge(source, options = {})
  default_opts = {:preserve_unmergeables => true}
  DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

#deeper_merge!(source, options = {}) ⇒ Object

deep_merge! will merge and overwrite any unmergeables in destination hash



12
13
14
15
# File 'lib/deep_merge/rails_compat.rb', line 12

def deeper_merge!(source, options = {})
  default_opts = {:preserve_unmergeables => false}
  DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end

#ko_deeper_merge!(source, options = {}) ⇒ Object

ko_hash_merge! will merge and knockout elements prefixed with DEFAULT_FIELD_KNOCKOUT_PREFIX



6
7
8
9
# File 'lib/deep_merge/rails_compat.rb', line 6

def ko_deeper_merge!(source, options = {})
  default_opts = {:knockout_prefix => "--", :preserve_unmergeables => false}
  DeepMerge::deep_merge!(source, self, default_opts.merge(options))
end