family-reunion 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/family-reunion.gemspec +1 -1
- data/lib/family-reunion/nomatch_organizer.rb +11 -7
- data/lib/family-reunion/top_node.rb +4 -3
- data/spec/top_node_spec.rb +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/family-reunion.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{family-reunion}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dmitry Mozzherin", "David Shorthouse"]
|
@@ -39,21 +39,25 @@ class FamilyReunion
|
|
39
39
|
name = path.pop.to_sym
|
40
40
|
if paths_hash.has_key?(name)
|
41
41
|
found_node = true
|
42
|
-
add_merged_node(paths_hash[name]
|
42
|
+
add_merged_node(paths_hash[name], node[:id].to_s.to_sym)
|
43
43
|
break
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
root_paths = @fr.primary_node.root_paths
|
47
|
+
add_merged_node(root_paths, node[:id].to_s.to_sym) unless found_node
|
47
48
|
end
|
48
49
|
|
49
|
-
def add_merged_node(
|
50
|
+
def add_merged_node(primary_paths, secondary_node_id)
|
51
|
+
primary_path = primary_paths[0]
|
52
|
+
primary_path_ids = primary_paths[1]
|
53
|
+
primary_node_id = primary_paths[1][-1]
|
50
54
|
secondary_node_id = secondary_node_id.to_s.to_sym
|
51
|
-
|
52
|
-
|
55
|
+
secondary_path = @fr.secondary_node.ids_hash[secondary_node_id][:path]
|
56
|
+
secondary_path_ids = @fr.secondary_node.ids_hash[secondary_node_id][:path_ids]
|
53
57
|
if @fr.merges.has_key?(primary_node_id) #never happens?
|
54
|
-
@fr.merges[primary_node_id][:nonmatches][secondary_node_id] = { :merge_type => "new", :path =>
|
58
|
+
@fr.merges[primary_node_id][:nonmatches][secondary_node_id] = { :merge_type => "new", :path => secondary_path, :path_ids => secondary_path_ids }
|
55
59
|
else
|
56
|
-
@fr.merges[primary_node_id] = { :matches => {}, :nonmatches => {secondary_node_id => { :merge_type => nil, :path =>
|
60
|
+
@fr.merges[primary_node_id] = { :path => primary_path, :path_ids => primary_path_ids, :matches => {}, :nonmatches => {secondary_node_id => { :merge_type => nil, :path => secondary_path, :path_ids => secondary_path_ids } } }
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
@@ -91,11 +91,12 @@ class FamilyReunion
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
95
|
-
unless @root_id
|
94
|
+
def root_paths
|
95
|
+
unless @root_name && @root_id
|
96
96
|
@root_id = data[:leaves][0][:path_ids][0].to_s.to_sym
|
97
|
+
@root_name = data[:leaves][0][:path][0]
|
97
98
|
end
|
98
|
-
@root_id
|
99
|
+
[[@root_name], [@root_id]]
|
99
100
|
end
|
100
101
|
|
101
102
|
end
|
data/spec/top_node_spec.rb
CHANGED
@@ -18,8 +18,8 @@ describe FamilyReunion::TopNode do
|
|
18
18
|
res[:Linepithema].should == [[:Formicidae, :Linepithema], [:"invasiveants:tid:1381", :"invasiveants:tid:1425"]]
|
19
19
|
end
|
20
20
|
|
21
|
-
it "should return root
|
22
|
-
@node.
|
21
|
+
it "should return root paths" do
|
22
|
+
@node.root_paths.should == [["Formicidae"], [:"invasiveants:tid:1381"]]
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dmitry Mozzherin
|
@@ -233,7 +233,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
233
233
|
requirements:
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
hash:
|
236
|
+
hash: -4464048702986745703
|
237
237
|
segments:
|
238
238
|
- 0
|
239
239
|
version: "0"
|