json-compare 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +4 -0
- data/json-compare.gemspec +1 -1
- data/lib/json-compare/comparer.rb +2 -2
- data/lib/json-compare/version.rb +1 -1
- data/spec/lib/json-compare_spec.rb +5 -0
- metadata +4 -3
data/CHANGES
CHANGED
data/json-compare.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["skvest1@gmail.com"]
|
7
7
|
gem.description = %q{Returns the difference between two JSON files}
|
8
8
|
gem.summary = %q{JSON Comparer}
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "https://github.com/a2design-company/json-compare"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -53,7 +53,7 @@ module JsonCompare
|
|
53
53
|
|
54
54
|
(0..inters).map do |n|
|
55
55
|
res = compare_elements(old_array[n], new_array[n])
|
56
|
-
result[:update][n] = res unless res.empty?
|
56
|
+
result[:update][n] = res unless (res.nil? || (res.respond_to?(:empty?) && res.empty?))
|
57
57
|
end
|
58
58
|
|
59
59
|
# the rest of the larger array
|
@@ -79,7 +79,7 @@ module JsonCompare
|
|
79
79
|
res = compare_elements(old_hash, new_array[0])
|
80
80
|
result[:update][n] = res unless res.empty?
|
81
81
|
else
|
82
|
-
|
82
|
+
result[:append][n] = new_array[n]
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
data/lib/json-compare/version.rb
CHANGED
@@ -105,6 +105,11 @@ describe 'Json compare' do
|
|
105
105
|
}
|
106
106
|
result.should eq(expected_result)
|
107
107
|
end
|
108
|
+
|
109
|
+
it "should compare arrays of fixnums" do
|
110
|
+
result = JsonCompare.get_diff([1, 2, 3], [1, 2, 3, 4])
|
111
|
+
result.should eq(:append => { 3 => 4 }, :update => { 3 => 4 })
|
112
|
+
end
|
108
113
|
end
|
109
114
|
|
110
115
|
describe "keys exclusion" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -83,7 +83,7 @@ files:
|
|
83
83
|
- spec/fixtures/twitter-search2.json
|
84
84
|
- spec/lib/json-compare_spec.rb
|
85
85
|
- spec/spec_helper.rb
|
86
|
-
homepage:
|
86
|
+
homepage: https://github.com/a2design-company/json-compare
|
87
87
|
licenses: []
|
88
88
|
post_install_message:
|
89
89
|
rdoc_options: []
|
@@ -112,3 +112,4 @@ test_files:
|
|
112
112
|
- spec/fixtures/twitter-search2.json
|
113
113
|
- spec/lib/json-compare_spec.rb
|
114
114
|
- spec/spec_helper.rb
|
115
|
+
has_rdoc:
|