README.md in hashdiff-0.2.3 vs README.md in hashdiff-0.3.0

- old
+ new

@@ -85,11 +85,12 @@ HashDiff.unpatch!(b, diff).should == a ``` ### Options -There are five options available: `:delimiter`, `:similarity`, `:strict`, `:numeric_tolerance` and `:strip`. +There are six options available: `:delimiter`, `:similarity`, +`:strict`, `:numeric_tolerance`, `:strip` and `:case_insensitive`. #### `:delimiter` You can specify `:delimiter` to be something other than the default dot. For example: @@ -131,10 +132,22 @@ diff = HashDiff.diff(a, b, :comparison => { :numeric_tolerance => 0.1, :strip => true }) diff.should == [["~", "x", 5, 6]] ``` +#### `:case_insensitive` + +The :case_insensitive option makes string comparisions ignore case. + +```ruby +a = {x:5, s:'FooBar'} +b = {x:6, s:'foobar'} + +diff = HashDiff.diff(a, b, :comparison => { :numeric_tolerance => 0.1, :case_insensitive => true }) +diff.should == [["~", "x", 5, 6]] +``` + #### Specifying a custom comparison method It's possible to specify how the values of a key should be compared. ```ruby @@ -180,26 +193,9 @@ HashDiff.diff(a, b) => [["+", "b[0]", "plane"], ["-", "b[2]", "plane"]] b[:b].sort! HashDiff.diff(a, b) => [] -``` - -### Special use cases - -#### Using HashDiff on JSON API results - -```ruby -require 'uri' -require 'net/http' -require 'json' - -uri = URI('http://time.jsontest.com/') -json_resp = ->(uri) { JSON.parse(Net::HTTP.get_response(uri).body) } -a = json_resp.call(uri) -b = json_resp.call(uri) - -HashDiff.diff(a,b) => [["~", "milliseconds_since_epoch", 1410542545874, 1410542545985]] ``` ## License HashDiff is distributed under the MIT-LICENSE.