Sha256: 8f14a646b0deef4c7e6e1fa77a2ac4cb4c1414c4a3d689c4258d6bee762144fd
Contents?: true
Size: 1.66 KB
Versions: 4
Compression:
Stored size: 1.66 KB
Contents
module Neo4j class << self # Start Neo4j using the default database. # This is usally not required since the database will be started automatically when it is used. # def start db = default_db db.start unless db.running? end # sets the default database to use def default_db=(my_db) @db = my_db end # Returns default database. Creates a new one if it does not exist, but does not start it. def default_db @db ||= Database.new end # Returns a started db instance. Starts it if's not running. def started_db db = default_db db.start unless db.running? db end # Returns an unstarted db instance # this is typically used for configuring the database, which must sometimes # be done before the database is started # if the database was already started an excetion will be raised def unstarted_db @db ||= Database.new raise "database was already started" if @db.running? @db end # returns true if the database is running def running? @db && @db.running? end def shutdown(this_db = @db) this_db.shutdown if this_db end def ref_node(this_db = self.started_db) this_db.graph.reference_node end # Returns an Enumerable object for all nodes in the database def all_nodes(this_db = self.started_db) Enumerator.new(this_db, :each_node) end # Same as #all_nodes but does not return wrapped nodes. def _all_nodes(this_db = self.started_db) Enumerator.new(this_db, :_each_node) end def event_handler(this_db = default_db) this_db.event_handler end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
neo4j-1.0.0.beta.17 | lib/neo4j/neo4j.rb |
neo4j-1.0.0.beta.16 | lib/neo4j/neo4j.rb |
neo4j-1.0.0.beta.15 | lib/neo4j/neo4j.rb |
neo4j-1.0.0.beta.14 | lib/neo4j/neo4j.rb |