Sha256: c99f146ae5e3c9915d15bade273e424859b3bf96e472099b0f998b3a87b34d2d
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
require 'active_support/core_ext/module/attribute_accessors' require 'neo4j/core/logging' require 'neo4j/core/has_uri' require 'neo4j/version' module Neo4j module Core class Driver include HasUri USER_AGENT_STRING = "neo4j-gem/#{::Neo4j::VERSION} (https://github.com/neo4jrb/neo4j)" attr_accessor :wrap_level attr_reader :options, :driver delegate :close, to: :driver default_url('bolt://neo4:neo4j@localhost:7687') validate_uri do |uri| uri.scheme == 'bolt' end class << self def new_instance(url, options = {}) uri = URI(url) user = uri.user password = uri.password auth_token = if user Neo4j::Driver::AuthTokens.basic(user, password) else Neo4j::Driver::AuthTokens.none end Neo4j::Driver::GraphDatabase.driver(url, auth_token, options) end end def initialize(url, options = {}, extended_options = {}) self.url = url @driver = self.class.new_instance(url, options) @options = extended_options end def logger return @logger if @logger @logger = if @options[:logger] @options[:logger] else Logger.new(logger_location).tap do |logger| logger.level = logger_level end end end private def logger_location @options[:logger_location] || STDOUT end def logger_level @options[:logger_level] || Logger::WARN end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
activegraph-10.0.0.pre.alpha.11 | lib/neo4j/core/driver.rb |
activegraph-10.0.0.pre.alpha.10 | lib/neo4j/core/driver.rb |
activegraph-10.0.0.pre.alpha.9 | lib/neo4j/core/driver.rb |