Sha256: 9c1e89f2fdbc17afd8f29451feec1954576ad0bd3157d5101e2d4aa82982d3cf
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 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.merge(encryption: false)) @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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activegraph-10.0.0.pre.alpha.8 | lib/neo4j/core/driver.rb |
activegraph-10.0.0.pre.alpha.7 | lib/neo4j/core/driver.rb |