json-compare 0.1.4 → 0.1.5

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 ADDED
@@ -0,0 +1,11 @@
1
+ = 0.1.5
2
+
3
+ * Fixed comparisons between true and false types (Olivier Carrere)
4
+
5
+ = 0.1.4
6
+
7
+ * Add possibility for exclusion of some keys from the comparisons (Stanislav Chistenko)
8
+
9
+ = 0.1
10
+
11
+ * Initial gem release
@@ -3,6 +3,10 @@ module JsonCompare
3
3
 
4
4
  attr_accessor :excluded_keys
5
5
 
6
+ def is_boolean(obj)
7
+ !!obj == obj
8
+ end
9
+
6
10
  def compare_elements(old, new)
7
11
  diff = {}
8
12
  if old.kind_of? Hash
@@ -12,7 +16,7 @@ module JsonCompare
12
16
  diff_hash = compare_hashes(old, new)
13
17
  end
14
18
  diff = diff_hash if diff_hash.count > 0
15
- elsif old.class != new.class
19
+ elsif (!is_boolean(old) || !is_boolean(new)) && old.class != new.class
16
20
  diff = new
17
21
  elsif old.kind_of? Array
18
22
  diff_arr = compare_arrays(old, new)
@@ -1,3 +1,3 @@
1
1
  module JsonCompare
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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
4
+ version: 0.1.5
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: 2012-09-09 00:00:00.000000000 Z
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -69,6 +69,7 @@ files:
69
69
  - .gitignore
70
70
  - .rspec
71
71
  - .travis.yml
72
+ - CHANGES
72
73
  - Gemfile
73
74
  - LICENSE
74
75
  - README.md