From b31f8298664d1ac580fb1e5167588da255135fcd Mon Sep 17 00:00:00 2001 From: Max De Marzi Date: Wed, 27 Feb 2013 23:55:57 -0600 Subject: [PATCH] finally fixed that all paths bug --- lib/neography/path_traverser.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/neography/path_traverser.rb b/lib/neography/path_traverser.rb index a4414fd..56f55b0 100644 --- a/lib/neography/path_traverser.rb +++ b/lib/neography/path_traverser.rb @@ -14,7 +14,8 @@ def initialize(from, to, algorithm, all=false, types = nil, dir = "all" ) @relationships << {"type" => type.to_s, "direction" => dir.to_s } end unless types.nil? @get = ["node","rel"] - @loaded = Array.new + @loaded_nodes = Array.new + @loaded_rels = Array.new end def nodes @@ -62,15 +63,15 @@ def each if @get.include?("node") path["nodes"].each_with_index do |n, i| - @loaded[n.split('/').last.to_i] = Neography::Node.load(n) if @loaded.at(n.split('/').last.to_i).nil? - paths[i * 2] = @loaded[n.split('/').last.to_i] + @loaded_nodes[n.split('/').last.to_i] = Neography::Node.load(n) if @loaded_nodes.at(n.split('/').last.to_i).nil? + paths[i * 2] = @loaded_nodes[n.split('/').last.to_i] end end if @get.include?("rel") path["relationships"].each_with_index do |r, i| - @loaded[r.split('/').last.to_i] = Neography::Relationship.load(r) if @loaded.at(r.split('/').last.to_i).nil? - paths[i * 2 + 1] = @loaded[r.split('/').last.to_i] + @loaded_rels[r.split('/').last.to_i] = Neography::Relationship.load(r) if @loaded_rels.at(r.split('/').last.to_i).nil? + paths[i * 2 + 1] = @loaded_rels[r.split('/').last.to_i] end end