Skip to content

Commit

Permalink
allowing Node.load and Node.create to be overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
pushbang authored and maxdemarzi committed Jan 10, 2012
1 parent 5b0132c commit bf039e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/neography/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bf039e2

Please sign in to comment.