hashdiff 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/Gemfile +1 -1
- data/changelog.md +4 -0
- data/lib/hashdiff/diff.rb +2 -2
- data/lib/hashdiff/patch.rb +4 -4
- data/lib/hashdiff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcd0946386679f0615a194c4114df01e7b1c84f8
|
4
|
+
data.tar.gz: 2020d0351371a98794d976daec63cea9784628f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca84a8e6fd0309147c0ecf7e70cf844e43ac5568201bfd73c9f579761721fdd3fa927b824ac68262237e661aa6bdfe44ca31f8e7c8d7e9e622e5b502de20ec7
|
7
|
+
data.tar.gz: 43f88705f7deca4b95b9cd438e46a8594e05872b33602d24c1166920665ff8b373ff75261a96d133620f6e36956b5d1df21d8b5310891620fbe24974e0e4c600
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/changelog.md
CHANGED
data/lib/hashdiff/diff.rb
CHANGED
@@ -7,7 +7,7 @@ module HashDiff
|
|
7
7
|
# @param [Array, Hash] obj1
|
8
8
|
# @param [Array, Hash] obj2
|
9
9
|
# @param [Hash] options the options to use when comparing
|
10
|
-
# * :strict (Boolean) [true] whether numeric values will be compared on type as well as value. Set to false to allow comparing
|
10
|
+
# * :strict (Boolean) [true] whether numeric values will be compared on type as well as value. Set to false to allow comparing Integer, Float, BigDecimal to each other
|
11
11
|
# * :delimiter (String) ['.'] the delimiter used when returning nested key references
|
12
12
|
# * :numeric_tolerance (Numeric) [0] should be a positive numeric value. Value by which numeric differences must be greater than. By default, numeric values are compared exactly; with the :tolerance option, the difference between numeric values must be greater than the given value.
|
13
13
|
# * :strip (Boolean) [false] whether or not to call #strip on strings before comparing
|
@@ -48,7 +48,7 @@ module HashDiff
|
|
48
48
|
# @param [Array, Hash] obj1
|
49
49
|
# @param [Array, Hash] obj2
|
50
50
|
# @param [Hash] options the options to use when comparing
|
51
|
-
# * :strict (Boolean) [true] whether numeric values will be compared on type as well as value. Set to false to allow comparing
|
51
|
+
# * :strict (Boolean) [true] whether numeric values will be compared on type as well as value. Set to false to allow comparing Integer, Float, BigDecimal to each other
|
52
52
|
# * :similarity (Numeric) [0.8] should be between (0, 1]. Meaningful if there are similar hashes in arrays. See {best_diff}.
|
53
53
|
# * :delimiter (String) ['.'] the delimiter used when returning nested key references
|
54
54
|
# * :numeric_tolerance (Numeric) [0] should be a positive numeric value. Value by which numeric differences must be greater than. By default, numeric values are compared exactly; with the :tolerance option, the difference between numeric values must be greater than the given value.
|
data/lib/hashdiff/patch.rb
CHANGED
@@ -23,13 +23,13 @@ module HashDiff
|
|
23
23
|
parent_node = node(obj, parts[0, parts.size-1])
|
24
24
|
|
25
25
|
if change[0] == '+'
|
26
|
-
if last_part.is_a?(
|
26
|
+
if last_part.is_a?(Integer)
|
27
27
|
parent_node.insert(last_part, change[2])
|
28
28
|
else
|
29
29
|
parent_node[last_part] = change[2]
|
30
30
|
end
|
31
31
|
elsif change[0] == '-'
|
32
|
-
if last_part.is_a?(
|
32
|
+
if last_part.is_a?(Integer)
|
33
33
|
parent_node.delete_at(last_part)
|
34
34
|
else
|
35
35
|
parent_node.delete(last_part)
|
@@ -62,13 +62,13 @@ module HashDiff
|
|
62
62
|
parent_node = node(obj, parts[0, parts.size-1])
|
63
63
|
|
64
64
|
if change[0] == '+'
|
65
|
-
if last_part.is_a?(
|
65
|
+
if last_part.is_a?(Integer)
|
66
66
|
parent_node.delete_at(last_part)
|
67
67
|
else
|
68
68
|
parent_node.delete(last_part)
|
69
69
|
end
|
70
70
|
elsif change[0] == '-'
|
71
|
-
if last_part.is_a?(
|
71
|
+
if last_part.is_a?(Integer)
|
72
72
|
parent_node.insert(last_part, change[2])
|
73
73
|
else
|
74
74
|
parent_node[last_part] = change[2]
|
data/lib/hashdiff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Fengyun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|