Sha256: 8cc772b62cb0d740e542b1cff1af8a9090e5a7e1578414143d364315615aeb44
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
module Neo4j class << self # Start Neo4j using the default database. # This is not required since the database will be started automatically when it is used. # def start default_db 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 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 def event_handler(this_db = default_db) this_db.event_handler end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neo4j-1.0.0.beta.3 | lib/neo4j/neo4j.rb |
neo4j-1.0.0.beta.2 | lib/neo4j/neo4j.rb |
neo4j-1.0.0.beta.1 | lib/neo4j/neo4j.rb |