happymapper-differ 0.1.1 → 0.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/.gitignore +1 -0
- data/README.md +2 -2
- data/lib/happymapper/differ.rb +1 -9
- data/lib/happymapper/un_extendable.rb +13 -0
- data/lib/happymapper_differ.rb +1 -0
- data/test/happymapper/un_extendable_test.rb +34 -0
- data/test/happymapper_differ_test.rb +1 -0
- metadata +7 -3
- data/Gemfile.lock +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123ce01a777fa69aabfaffac4e0e0f6136b51b94
|
4
|
+
data.tar.gz: f6a65efcc80f520ff9d0d6a9fbbcb3b101540e25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf6ef58b8bef1688149e34b872c9d3bc9be166a42e743f81758ff99fb2efe60422cc2032c2519a8406f4e85145e962fba0aaac336ce877239331cbb70cdda35
|
7
|
+
data.tar.gz: f7f42a4e37c1356db7afc9e1b5f1f16ddde22b4cf7c6e6fc18e212ec4699a0dfc0e2a401d39e40f1606957008da400058953fe241c60cbcea5db22cc19e4a6d1
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/README.md
CHANGED
@@ -76,8 +76,8 @@ HappyMapper::Differ extends each HappyMapper instance and element with the follo
|
|
76
76
|
|method|purpose|
|
77
77
|
|------|-------|
|
78
78
|
|changed?| returns true if this element, or a child has changed |
|
79
|
-
|changes | returns a
|
80
|
-
|was | returns the prior
|
79
|
+
|changes | returns a hash with each element or attribute which changed, and changed value |
|
80
|
+
|was | returns the prior object from the right. If there is no change this will be the current value. |
|
81
81
|
|
82
82
|
|
83
83
|
## Contributing
|
data/lib/happymapper/differ.rb
CHANGED
@@ -7,7 +7,7 @@ module HappyMapper
|
|
7
7
|
# First step is map all nodes into a DiffedItem
|
8
8
|
# Step two is present all the changes via DiffedItem.changes
|
9
9
|
class Differ
|
10
|
-
VERSION = "0.
|
10
|
+
VERSION = "0.2"
|
11
11
|
|
12
12
|
def initialize(left, right)
|
13
13
|
@left = left
|
@@ -70,14 +70,6 @@ module HappyMapper
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
# nil, Float, and other classes can't be extended
|
74
|
-
# so this object acts as wrapper
|
75
|
-
class UnExtendable < SimpleDelegator
|
76
|
-
def class
|
77
|
-
__getobj__.class
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
73
|
# DiffedItem is an extension which allows tracking changes between two
|
82
74
|
# HappyMapper objects.
|
83
75
|
module DiffedItem
|
data/lib/happymapper_differ.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe HappyMapper::UnExtendable do
|
4
|
+
let(:t) do
|
5
|
+
HappyMapper::UnExtendable
|
6
|
+
.new(type)
|
7
|
+
.extend(HappyMapper::DiffedItem)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe TrueClass do
|
11
|
+
let(:type) { true }
|
12
|
+
|
13
|
+
it { ! t.nil? }
|
14
|
+
it "is comparable to a TrueClass" do
|
15
|
+
assert_equal t, true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe Float do
|
20
|
+
let(:type) { 1.1 }
|
21
|
+
it { ! t.nil? }
|
22
|
+
it "is comparable to a Float" do
|
23
|
+
assert_equal 1.1, t
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe NilClass do
|
28
|
+
let(:type) { nil }
|
29
|
+
it { t.nil? }
|
30
|
+
it "is comparable to a Float" do
|
31
|
+
assert_equal t, nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: happymapper-differ
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Weir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri-happymapper
|
@@ -77,17 +77,19 @@ executables: []
|
|
77
77
|
extensions: []
|
78
78
|
extra_rdoc_files: []
|
79
79
|
files:
|
80
|
+
- ".gitignore"
|
80
81
|
- CHANGELOG.md
|
81
82
|
- Gemfile
|
82
|
-
- Gemfile.lock
|
83
83
|
- LICENSE
|
84
84
|
- README.md
|
85
85
|
- Rakefile
|
86
86
|
- happymapper-differ.gemspec
|
87
87
|
- lib/happymapper/differ.rb
|
88
|
+
- lib/happymapper/un_extendable.rb
|
88
89
|
- lib/happymapper_differ.rb
|
89
90
|
- test/happymapper/change_lister_test.rb
|
90
91
|
- test/happymapper/diffed_item_test.rb
|
92
|
+
- test/happymapper/un_extendable_test.rb
|
91
93
|
- test/happymapper_differ_test.rb
|
92
94
|
- test/test_helper.rb
|
93
95
|
homepage: https://github.com/pharos-ei/happymapper-differ
|
@@ -117,5 +119,7 @@ summary: Find changes between two like HappyMapper objects
|
|
117
119
|
test_files:
|
118
120
|
- test/happymapper/change_lister_test.rb
|
119
121
|
- test/happymapper/diffed_item_test.rb
|
122
|
+
- test/happymapper/un_extendable_test.rb
|
120
123
|
- test/happymapper_differ_test.rb
|
121
124
|
- test/test_helper.rb
|
125
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
happymapper_differ (0.1)
|
5
|
-
nokogiri-happymapper (~> 0.5.9)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
byebug (3.5.1)
|
11
|
-
columnize (~> 0.8)
|
12
|
-
debugger-linecache (~> 1.2)
|
13
|
-
slop (~> 3.6)
|
14
|
-
columnize (0.9.0)
|
15
|
-
debugger-linecache (1.2.0)
|
16
|
-
mini_portile (0.6.2)
|
17
|
-
nokogiri (1.6.6.2)
|
18
|
-
mini_portile (~> 0.6.0)
|
19
|
-
nokogiri-happymapper (0.5.9)
|
20
|
-
nokogiri (~> 1.5)
|
21
|
-
rake (10.4.2)
|
22
|
-
slop (3.6.0)
|
23
|
-
|
24
|
-
PLATFORMS
|
25
|
-
ruby
|
26
|
-
|
27
|
-
DEPENDENCIES
|
28
|
-
bundler (~> 1.7)
|
29
|
-
byebug (~> 3.5)
|
30
|
-
happymapper_differ!
|
31
|
-
rake (~> 10.0)
|