From ab311b8dc9c86848ee4c397989908c37df79e3f8 Mon Sep 17 00:00:00 2001 From: Jack C Hong Date: Thu, 21 Jun 2012 16:29:48 +1000 Subject: [PATCH] Put module deep_merge into correct namespace --- lib/application_config/deep_merge.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/application_config/deep_merge.rb b/lib/application_config/deep_merge.rb index 2884f57..04f506b 100644 --- a/lib/application_config/deep_merge.rb +++ b/lib/application_config/deep_merge.rb @@ -1,7 +1,8 @@ +module ApplicationConfig module DeepMerge - + class InvalidParameter < StandardError; end - + DEFAULT_FIELD_KNOCKOUT_PREFIX = '--' # Deep Merge core documentation. @@ -18,7 +19,7 @@ class InvalidParameter < StandardError; end # Results: {:x => [1,2,3,4,5,'6'], :y => 2} # By default, "deep_merge!" will overwrite any unmergeables and merge everything else. # To avoid this, use "deep_merge" (no bang/exclamation mark) - # + # # Options: # Options are specified in the last parameter passed, which should be in hash format: # hash.deep_merge!({:x => [1,2]}, {:knockout_prefix => '--'}) @@ -34,7 +35,7 @@ class InvalidParameter < StandardError; end # Set to true to get console output of merge process for debugging # # Selected Options Details: - # :knockout_prefix => The purpose of this is to provide a way to remove elements + # :knockout_prefix => The purpose of this is to provide a way to remove elements # from existing Hash by specifying them in a special way in incoming hash # source = {:x => ['--1', '2']} # dest = {:x => ['1', '3']} @@ -52,9 +53,9 @@ class InvalidParameter < StandardError; end # dest = {:x => ['5','6','7,8']} # dest.deep_merge!(source, {:unpack_arrays => ','}) # Results: {:x => ['1','2','3','4','5','6','7','8'} - # Why: If receiving data from an HTML form, this makes it easy for a checkbox + # Why: If receiving data from an HTML form, this makes it easy for a checkbox # to pass multiple values from within a single HTML element - # + # # There are many tests for this library - and you can learn more about the features # and usages of deep_merge! by just browsing the test examples def DeepMerge.deep_merge!(source, dest, options = {}) @@ -178,4 +179,5 @@ def DeepMerge::clear_or_nil(obj) obj end -end # module DeepMerge \ No newline at end of file +end # module DeepMerge +end