Sha256: e8a5a8cef58236fcb933e6aa4bd6598427ea778ff37bd455be073a6ee1d53295
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module Neo4jr class DB class << self def instance @neo ||= begin neo = org.neo4j.api.core.EmbeddedNeo.new(Configuration.database_path) at_exit do neo.shutdown end neo end end def getNodeById(node_id) n = nil execute do |neo| n = neo.getNodeById(node_id) end return n end def execute neo = instance transaction = neo.beginTx(); begin yield neo transaction.success rescue Exception => e transaction.failure raise e ensure transaction.finish end end def node_count instance.getConfig().getNeoModule().getNodeManager().getNumberOfIdsInUse(org.neo4j.api.core.Node.java_class) end def stats info = ['== Database Stats =='] info << "Path: #{Configuration.database_path}" info << "Nodes: #{node_count}" info << '====================' info.join("\n") end def to_s stats end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
neo4jr-simple-0.1.0 | lib/neo4jr/db.rb |