Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged with the original to update the gem, but keep our customizations #1

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
548df94
make library 1.8.7 compatible
liufengyun Oct 6, 2014
f9cbbeb
update version to 0.2.2
liufengyun Oct 6, 2014
687de5d
remove demo link
liufengyun Aug 26, 2015
75ed5b5
Use a_start and b_start variables in HashDiff.lcs
keram Nov 4, 2015
6844a34
Merge pull request #12 from keram/patch-1
liufengyun Nov 4, 2015
bfa0320
bumps version to 0.2.3
liufengyun Nov 5, 2015
45c572d
Add case insensitive option
ronco Feb 11, 2016
366d83b
add :case_insensitive option to README
ronco Feb 11, 2016
26f6a71
bumps version to 0.3.0
liufengyun Feb 11, 2016
fcb2b30
try fix travis test
liufengyun Feb 11, 2016
d07ae0a
Fix bug with array under hash key with non-word characters.
eirc May 28, 2016
7935759
don't test 1.8.7
liufengyun May 29, 2016
fff6fc2
Merge pull request #18 from eirc/master
liufengyun May 29, 2016
af067d6
add test to :delimiter in patch/unpatch
liufengyun Sep 1, 2016
68425c1
fix an error when a hash has mixed types
ZeroPointEnergy Nov 23, 2016
9df2cb5
Merge pull request #26 from ZeroPointEnergy/fix/mixed_keys
liufengyun Nov 24, 2016
a8f5873
bumps to 0.3.1
liufengyun Nov 24, 2016
938f747
New rubies support.
marshall-lee Dec 27, 2016
0b37a28
Merge pull request #28 from marshall-lee/new-rubies-support
liufengyun Dec 27, 2016
9cacb45
bumps to 0.3.2
liufengyun Dec 27, 2016
1a4bf75
Mention 2 compelling reasons to start using HashDiff
thbar Feb 8, 2017
addd333
Merge pull request #30 from thbar/patch-1
liufengyun Feb 21, 2017
1d1960a
Greatly improve performance of HashDiff#similar?
cloakedcode May 1, 2017
5751a2d
Merge pull request #31 from cloakedcode/early-return-similar
liufengyun May 1, 2017
7588d7d
bumps to 0.3.4
liufengyun May 1, 2017
7ada0b7
add codecov gem
stephengroat Jul 6, 2017
c553aa3
add codecov
stephengroat Jul 6, 2017
7271736
Merge pull request #33 from stephengroat/patch-1
liufengyun Jul 8, 2017
acb2d7e
Update patch documentation on README
kevindew Jul 29, 2017
9f44b1c
Introduce an array_path option
kevindew Jul 29, 2017
04e4e8b
Fix typo
kevindew Aug 3, 2017
5c47aff
Merge pull request #34 from kevindew/array_path
liufengyun Aug 6, 2017
83c6f4b
bumps to 0.3.5
liufengyun Aug 6, 2017
a885a77
Option to allow array comparisons in linear complexity
kevindew Aug 22, 2017
5dea0c7
Merge pull request #35 from kevindew/linear-arrays
liufengyun Aug 22, 2017
30a59a8
remove code coverage
liufengyun Aug 22, 2017
8c40f16
bumps to 0.3.6
liufengyun Aug 22, 2017
59a92b3
Documentation for the :use_lcs option
kevindew Aug 22, 2017
a5e22bb
Merge pull request #36 from kevindew/linear-array-docs
liufengyun Aug 23, 2017
34681b2
update minimum ruby to reflect actual support
lostapathy Oct 7, 2017
f153d24
set higher retry, bump ruby versions
lostapathy Oct 7, 2017
70fc43e
attempting to work around apparently bundler problem with travis and …
lostapathy Oct 7, 2017
0c00625
Merge pull request #39 from lostapathy/minimum_ruby
liufengyun Oct 7, 2017
0946ded
bumps to 0.3.7
liufengyun Oct 8, 2017
c0dc7b4
Merge remote-tracking branch 'original/master' into merged
Jul 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/hashdiff/util.rb
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ def self.count_nodes(obj)
# e.g. "a.b[3].c" => ['a', 'b', 3, 'c']
def self.decode_property_path(path, delimiter='.')
parts = path.split(delimiter).collect do |part|
if part =~ /^(\w*)\[(\d+)\]$/
if part =~ /^(.*)\[(\d+)\]$/
if $1.size > 0
[$1, $2.to_i]
else
12 changes: 12 additions & 0 deletions spec/hashdiff/patch_spec.rb
Original file line number Diff line number Diff line change
@@ -61,6 +61,18 @@
HashDiff.unpatch!(b, diff).should == a
end

it "should be able to patch array under hash key with non-word characters" do
a = {"a" => 1, "b-b" => [1, 2]}
b = {"a" => 1, "b-b" => [2, 1]}
diff = HashDiff.diff(a, b)

HashDiff.patch!(a, diff).should == b

a = {"a" => 1, "b-b" => [1, 2]}
b = {"a" => 1, "b-b" => [2, 1]}
HashDiff.unpatch!(b, diff).should == a
end

it "should be able to patch hash value removal" do
a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
b = {"a" => 1}