From bf039e2fca6bb9250cbb887cf5291a727800bf23 Mon Sep 17 00:00:00 2001 From: pushbang Date: Sun, 18 Dec 2011 16:30:22 +0800 Subject: [PATCH] allowing Node.load and Node.create to be overridden --- lib/neography/node.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/neography/node.rb b/lib/neography/node.rb index 7ac2596..f6f762c 100644 --- a/lib/neography/node.rb +++ b/lib/neography/node.rb @@ -13,7 +13,7 @@ def create(*args) # the arguments can be an hash of properties to set or a rest instance props = (args[0].respond_to?(:each_pair) && args[0]) || args[1] db = (args[0].is_a?(Neography::Rest) && args[0]) || args[1] || Neography::Rest.new - node = Neography::Node.new(db.create_node(props)) + node = self.class.new(db.create_node(props)) node.neo_server = db node end @@ -25,7 +25,7 @@ def load(*args) # a db instance can be given, it is the first argument or the second db = (args[0].is_a?(Neography::Rest) && args[0]) || args[1] || Neography::Rest.new node = db.get_node(node) - node = Neography::Node.new(node) unless node.nil? + node = self.class.new(node) unless node.nil? node.neo_server = db unless node.nil? node end