neo4j 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +10 -0
  3. data/Gemfile +6 -16
  4. data/README.md +5 -2
  5. data/bin/neo4j-jars +6 -6
  6. data/lib/neo4j.rb +13 -9
  7. data/lib/neo4j/active_node.rb +9 -9
  8. data/lib/neo4j/active_node/dependent.rb +11 -0
  9. data/lib/neo4j/active_node/dependent/association_methods.rb +28 -0
  10. data/lib/neo4j/active_node/dependent/query_proxy_methods.rb +48 -0
  11. data/lib/neo4j/active_node/has_n.rb +124 -112
  12. data/lib/neo4j/active_node/has_n/association.rb +45 -30
  13. data/lib/neo4j/active_node/id_property.rb +22 -19
  14. data/lib/neo4j/active_node/initialize.rb +2 -4
  15. data/lib/neo4j/active_node/labels.rb +23 -22
  16. data/lib/neo4j/active_node/node_wrapper.rb +5 -8
  17. data/lib/neo4j/active_node/orm_adapter.rb +2 -4
  18. data/lib/neo4j/active_node/persistence.rb +5 -10
  19. data/lib/neo4j/active_node/property.rb +3 -4
  20. data/lib/neo4j/active_node/query.rb +27 -6
  21. data/lib/neo4j/active_node/query/query_proxy.rb +65 -110
  22. data/lib/neo4j/active_node/query/query_proxy_enumerable.rb +67 -0
  23. data/lib/neo4j/active_node/query/query_proxy_find_in_batches.rb +0 -1
  24. data/lib/neo4j/active_node/query/query_proxy_methods.rb +29 -28
  25. data/lib/neo4j/active_node/query_methods.rb +6 -6
  26. data/lib/neo4j/active_node/reflection.rb +3 -2
  27. data/lib/neo4j/active_node/rels.rb +1 -1
  28. data/lib/neo4j/active_node/scope.rb +13 -8
  29. data/lib/neo4j/active_node/validations.rb +5 -6
  30. data/lib/neo4j/active_rel.rb +1 -2
  31. data/lib/neo4j/active_rel/callbacks.rb +3 -3
  32. data/lib/neo4j/active_rel/persistence.rb +9 -7
  33. data/lib/neo4j/active_rel/property.rb +12 -4
  34. data/lib/neo4j/active_rel/query.rb +6 -8
  35. data/lib/neo4j/active_rel/rel_wrapper.rb +0 -2
  36. data/lib/neo4j/active_rel/related_node.rb +4 -5
  37. data/lib/neo4j/active_rel/types.rb +4 -6
  38. data/lib/neo4j/active_rel/validations.rb +0 -1
  39. data/lib/neo4j/config.rb +11 -23
  40. data/lib/neo4j/core/query.rb +1 -1
  41. data/lib/neo4j/migration.rb +17 -18
  42. data/lib/neo4j/paginated.rb +4 -4
  43. data/lib/neo4j/railtie.rb +19 -19
  44. data/lib/neo4j/shared.rb +7 -3
  45. data/lib/neo4j/shared/callbacks.rb +15 -4
  46. data/lib/neo4j/shared/identity.rb +2 -2
  47. data/lib/neo4j/shared/persistence.rb +10 -21
  48. data/lib/neo4j/shared/property.rb +17 -30
  49. data/lib/neo4j/shared/rel_type_converters.rb +1 -3
  50. data/lib/neo4j/shared/type_converters.rb +13 -25
  51. data/lib/neo4j/shared/validations.rb +3 -3
  52. data/lib/neo4j/tasks/migration.rake +7 -7
  53. data/lib/neo4j/type_converters.rb +1 -1
  54. data/lib/neo4j/version.rb +1 -1
  55. data/lib/rails/generators/neo4j/model/model_generator.rb +16 -12
  56. data/lib/rails/generators/neo4j_generator.rb +18 -18
  57. data/neo4j.gemspec +22 -18
  58. metadata +103 -1
@@ -3,10 +3,10 @@ module Neo4j::ActiveRel
3
3
  extend ActiveSupport::Concern
4
4
  include Neo4j::Shared::Property
5
5
 
6
- %w[to_node from_node].each do |direction|
6
+ %w(to_node from_node).each do |direction|
7
7
  define_method("#{direction}") { instance_variable_get("@#{direction}") }
8
8
  define_method("#{direction}=") do |argument|
9
- raise FrozenRelError, 'Relationship start/end nodes cannot be changed once persisted' if self.persisted?
9
+ fail FrozenRelError, 'Relationship start/end nodes cannot be changed once persisted' if self.persisted?
10
10
  instance_variable_set("@#{direction}", argument)
11
11
  end
12
12
  end
@@ -34,7 +34,7 @@ module Neo4j::ActiveRel
34
34
  end
35
35
  end
36
36
 
37
- %w[to_class from_class].each do |direction|
37
+ %w(to_class from_class).each do |direction|
38
38
  define_method("#{direction}") { |argument| instance_variable_set("@#{direction}", argument) }
39
39
  define_method("_#{direction}") { instance_variable_get "@#{direction}" }
40
40
  end
@@ -45,6 +45,14 @@ module Neo4j::ActiveRel
45
45
  def load_entity(id)
46
46
  Neo4j::Node.load(id)
47
47
  end
48
+
49
+ def creates_unique_rel
50
+ @unique = true
51
+ end
52
+
53
+ def unique?
54
+ !!@unique
55
+ end
48
56
  end
49
57
 
50
58
  private
@@ -54,4 +62,4 @@ module Neo4j::ActiveRel
54
62
  @to_node = RelatedNode.new(to_node)
55
63
  end
56
64
  end
57
- end
65
+ end
@@ -3,18 +3,17 @@ module Neo4j::ActiveRel
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  module ClassMethods
6
-
7
6
  # Returns the object with the specified neo4j id.
8
7
  # @param [String,Fixnum] id of node to find
9
8
  # @param [Neo4j::Session] session optional
10
9
  def find(id, session = self.neo4j_session)
11
- raise "Unknown argument #{id.class} in find method (expected String or Fixnum)" if not [String, Fixnum].include?(id.class)
10
+ fail "Unknown argument #{id.class} in find method (expected String or Fixnum)" if not [String, Fixnum].include?(id.class)
12
11
  find_by_id(id, session)
13
12
  end
14
13
 
15
14
  # Loads the relationship using its neo_id.
16
15
  def find_by_id(key, session = Neo4j::Session.current!)
17
- session.query.match("()-[r]-()").where("ID(r)" => key.to_i).limit(1).return(:r).first.r
16
+ session.query.match('()-[r]-()').where('ID(r)' => key.to_i).limit(1).return(:r).first.r
18
17
  end
19
18
 
20
19
  # Performs a very basic match on the relationship.
@@ -22,7 +21,7 @@ module Neo4j::ActiveRel
22
21
  # To use a string, prefix the property with "r1"
23
22
  # @example Match with a string
24
23
  # MyRelClass.where('r1.grade > r1')
25
- def where(args={})
24
+ def where(args = {})
26
25
  where_query.where(where_string(args)).pluck(:r1)
27
26
  end
28
27
 
@@ -33,11 +32,11 @@ module Neo4j::ActiveRel
33
32
  end
34
33
 
35
34
  def first
36
- all_query.limit(1).order("ID(r1)").pluck(:r1).first
35
+ all_query.limit(1).order('ID(r1)').pluck(:r1).first
37
36
  end
38
37
 
39
38
  def last
40
- all_query.limit(1).order("ID(r1) DESC").pluck(:r1).first
39
+ all_query.limit(1).order('ID(r1) DESC').pluck(:r1).first
41
40
  end
42
41
 
43
42
  private
@@ -85,7 +84,6 @@ module Neo4j::ActiveRel
85
84
  args
86
85
  end
87
86
  end
88
-
89
87
  end
90
88
  end
91
- end
89
+ end
@@ -1,5 +1,4 @@
1
1
  class Neo4j::Relationship
2
-
3
2
  module Wrapper
4
3
  def wrapper
5
4
  props.symbolize_keys!
@@ -25,5 +24,4 @@ class Neo4j::Relationship
25
24
  Neo4j::ActiveRel::Types::WRAPPED_CLASSES[rel_type] || rel_type.camelize
26
25
  end
27
26
  end
28
-
29
27
  end
@@ -3,7 +3,6 @@ module Neo4j::ActiveRel
3
3
  # It's important (or maybe not really IMPORTANT, but at least worth mentioning) that calling method_missing
4
4
  # will result in a query to load the node if the node is not already loaded.
5
5
  class RelatedNode
6
-
7
6
  class InvalidParameterError < StandardError; end
8
7
 
9
8
  # ActiveRel's related nodes can be initialized with nothing, an integer, or a fully wrapped node.
@@ -15,13 +14,13 @@ module Neo4j::ActiveRel
15
14
  #
16
15
  # Initialization with a node doesn't appear to happen in the code. TODO: maybe find out why this is an option.
17
16
  def initialize(node = nil)
18
- @node = valid_node_param?(node) ? node : (raise InvalidParameterError, 'RelatedNode must be initialized with either a node ID or node' )
17
+ @node = valid_node_param?(node) ? node : (fail InvalidParameterError, 'RelatedNode must be initialized with either a node ID or node')
19
18
  end
20
19
 
21
20
  # Loads the node if needed, then conducts comparison.
22
- def == (obj)
21
+ def ==(other)
23
22
  loaded if @node.is_a?(Fixnum)
24
- @node == obj
23
+ @node == other
25
24
  end
26
25
 
27
26
  # Returns the neo_id of a given node without loading.
@@ -53,4 +52,4 @@ module Neo4j::ActiveRel
53
52
  node.nil? || node.is_a?(Integer) || node.respond_to?(:neo_id)
54
53
  end
55
54
  end
56
- end
55
+ end
@@ -1,6 +1,5 @@
1
1
  module Neo4j
2
2
  module ActiveRel
3
-
4
3
  # provides mapping of type to model name
5
4
  module Types
6
5
  extend ActiveSupport::Concern
@@ -21,7 +20,7 @@ module Neo4j
21
20
  # which will completely bypass this whole process.
22
21
  WRAPPED_CLASSES = {}
23
22
 
24
- included do |klazz|
23
+ included do
25
24
  type self.name, true
26
25
  end
27
26
 
@@ -36,12 +35,11 @@ module Neo4j
36
35
  end
37
36
 
38
37
  # @return [String] a string representing the relationship type that will be created
39
- def _type
40
- @rel_type
41
- end
38
+ attr_reader :rel_type
39
+ alias_method :_type, :rel_type # Should be deprecated
42
40
 
43
41
  def add_wrapped_class(type)
44
- #_wrapped_classes[type.to_sym.downcase] = self.name
42
+ # _wrapped_classes[type.to_sym.downcase] = self.name
45
43
  _wrapped_classes[type.to_sym] = self.name
46
44
  end
47
45
 
@@ -3,7 +3,6 @@ module Neo4j
3
3
  module Validations
4
4
  extend ActiveSupport::Concern
5
5
  include Neo4j::Shared::Validations
6
-
7
6
  end
8
7
  end
9
8
  end
@@ -1,16 +1,12 @@
1
1
  module Neo4j
2
-
3
-
4
2
  # == Keeps configuration for neo4j
5
3
  #
6
4
  # == Configurations keys
7
5
  #
8
6
  class Config
9
-
10
- DEFAULT_FILE = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "config", "neo4j", "config.yml"))
7
+ DEFAULT_FILE = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'neo4j', 'config.yml'))
11
8
 
12
9
  class << self
13
-
14
10
  # @return [Fixnum] The location of the default configuration file.
15
11
  def default_file
16
12
  @default_file ||= DEFAULT_FILE
@@ -32,14 +28,13 @@ module Neo4j
32
28
  end
33
29
 
34
30
  # Reads from the default_file if configuration is not set already
35
- # @return [Hash] the configuration
36
- def get_or_setup_configuration
37
- @configuration ||= setup
38
- end
39
-
40
31
  # @return [Hash] the configuration
41
32
  def configuration
42
- @configuration || {}
33
+ return @configuration if @configuration
34
+
35
+ @configuration = ActiveSupport::HashWithIndifferentAccess.new
36
+ @configuration.merge!(defaults)
37
+ @configuration
43
38
  end
44
39
 
45
40
  # Yields the configuration
@@ -64,14 +59,14 @@ module Neo4j
64
59
  # @param [Symbol] key the key to set the parameter for
65
60
  # @param val the value of the parameter.
66
61
  def []=(key, val)
67
- get_or_setup_configuration[key.to_s] = val
62
+ configuration[key.to_s] = val
68
63
  end
69
64
 
70
65
 
71
66
  # @param [Symbol] key The key of the config entry value we want
72
67
  # @return the the value of a config entry
73
68
  def [](key)
74
- get_or_setup_configuration[key.to_s]
69
+ configuration[key.to_s]
75
70
  end
76
71
 
77
72
 
@@ -80,7 +75,7 @@ module Neo4j
80
75
  # @param [Symbol] key the key of the configuration entry to delete
81
76
  # @return The value of the removed entry.
82
77
  def delete(key)
83
- get_or_setup_configuration.delete(key)
78
+ configuration.delete(key)
84
79
  end
85
80
 
86
81
 
@@ -94,19 +89,12 @@ module Neo4j
94
89
 
95
90
  # @return [Hash] The config as a hash.
96
91
  def to_hash
97
- get_or_setup_configuration.to_hash
92
+ configuration.to_hash
98
93
  end
99
94
 
100
95
  # @return [String] The config as a YAML
101
96
  def to_yaml
102
- get_or_setup_configuration.to_yaml
103
- end
104
-
105
- # @return The a new configuration using default values as a hash.
106
- def setup
107
- @configuration = ActiveSupport::HashWithIndifferentAccess.new
108
- @configuration.merge!(defaults)
109
- @configuration
97
+ configuration.to_yaml
110
98
  end
111
99
 
112
100
  def class_name_property
@@ -8,7 +8,7 @@ module Neo4j::Core
8
8
  # @return [Neo4j::ActiveNode::Query::QueryProxy] A QueryProxy object.
9
9
  def proxy_as(model, var, optional = false)
10
10
  # TODO: Discuss whether it's necessary to call `break` on the query or if this should be left to the user.
11
- Neo4j::ActiveNode::Query::QueryProxy.new(model, nil, { starting_query: self.break, node: var, optional: optional })
11
+ Neo4j::ActiveNode::Query::QueryProxy.new(model, nil, starting_query: self.break, node: var, optional: optional)
12
12
  end
13
13
 
14
14
  # Calls proxy_as with `optional` set true. This doesn't offer anything different from calling `proxy_as` directly but it may be more readable.
@@ -1,8 +1,7 @@
1
1
  module Neo4j
2
2
  class Migration
3
-
4
3
  def migrate
5
- raise 'not implemented'
4
+ fail 'not implemented'
6
5
  end
7
6
 
8
7
  def output(string = '')
@@ -30,8 +29,8 @@ module Neo4j
30
29
 
31
30
  def migrate
32
31
  models = ActiveSupport::HashWithIndifferentAccess.new(YAML.load_file(models_filename))[:models]
33
- output "This task will add an ID Property every node in the given file."
34
- output "It may take a significant amount of time, please be patient."
32
+ output 'This task will add an ID Property every node in the given file.'
33
+ output 'It may take a significant amount of time, please be patient.'
35
34
  models.each do |model|
36
35
  output
37
36
  output
@@ -41,7 +40,7 @@ module Neo4j
41
40
  end
42
41
 
43
42
  def setup
44
- FileUtils.mkdir_p("db/neo4j-migrate")
43
+ FileUtils.mkdir_p('db/neo4j-migrate')
45
44
  unless File.file?(models_filename)
46
45
  File.open(models_filename, 'w') do |file|
47
46
  file.write("# Provide models to which IDs should be added.\n# It will only modify nodes that do not have IDs. There is no danger of overwriting data.\n# models: [Student,Lesson,Teacher,Exam]\nmodels: []")
@@ -62,7 +61,7 @@ module Neo4j
62
61
  last_time_taken = nil
63
62
 
64
63
  until nodes_left == 0
65
- nodes_left = Neo4j::Session.query.match(n: label).where("NOT has(n.#{property})").return("COUNT(n) AS ids").first.ids
64
+ nodes_left = Neo4j::Session.query.match(n: label).where("NOT has(n.#{property})").return('COUNT(n) AS ids').first.ids
66
65
 
67
66
  time_per_node = last_time_taken / max_per_batch if last_time_taken
68
67
  print_output "Running first batch...\r"
@@ -108,7 +107,7 @@ module Neo4j
108
107
 
109
108
  def new_id_for(model)
110
109
  if model.id_property_info[:type][:auto]
111
- SecureRandom::uuid
110
+ SecureRandom.uuid
112
111
  else
113
112
  model.new.send(model.id_property_info[:type][:on])
114
113
  end
@@ -116,32 +115,32 @@ module Neo4j
116
115
  end
117
116
 
118
117
  class AddClassnames < Neo4j::Migration
119
-
120
118
  def initialize(path = default_path)
121
119
  @classnames_filename = 'add_classnames.yml'
122
120
  @classnames_filepath = File.join(joined_path(path), classnames_filename)
123
121
  end
124
122
 
125
123
  def migrate
126
- output "Adding classnames. This make take some time."
124
+ output 'Adding classnames. This make take some time.'
127
125
  execute(true)
128
126
  end
129
127
 
130
128
  def test
131
- output "TESTING! No queries will be executed."
129
+ output 'TESTING! No queries will be executed.'
132
130
  execute(false)
133
131
  end
134
132
 
135
133
  def setup
136
134
  output "Creating file #{classnames_filepath}. Please use this as the migration guide."
137
- FileUtils.mkdir_p("db/neo4j-migrate")
135
+ FileUtils.mkdir_p('db/neo4j-migrate')
138
136
  unless File.file?(classnames_filepath)
139
- source = File.join(File.dirname(__FILE__), "..", "..", "config", "neo4j", classnames_filename)
137
+ source = File.join(File.dirname(__FILE__), '..', '..', 'config', 'neo4j', classnames_filename)
140
138
  FileUtils.copy_file(source, classnames_filepath)
141
139
  end
142
140
  end
143
141
 
144
142
  private
143
+
145
144
  attr_reader :classnames_filename, :classnames_filepath, :model_map
146
145
 
147
146
  def execute(migrate = false)
@@ -165,7 +164,7 @@ module Neo4j
165
164
  end
166
165
 
167
166
  def file_init
168
- @model_map = ActiveSupport::HashWithIndifferentAccess.new(YAML.load_file(classnames_filepath))
167
+ @model_map = ActiveSupport::HashWithIndifferentAccess.new(YAML.load_file(classnames_filepath))
169
168
  end
170
169
 
171
170
  def node_cypher(label, action)
@@ -178,11 +177,11 @@ module Neo4j
178
177
  label = hash[0]
179
178
  value = hash[1]
180
179
  from = value[:from]
181
- raise "All relationships require a 'type'" unless value[:type]
180
+ fail "All relationships require a 'type'" unless value[:type]
182
181
 
183
- from_cypher = from ? "(from:`#{from}`)" : "(from)"
182
+ from_cypher = from ? "(from:`#{from}`)" : '(from)'
184
183
  to = value[:to]
185
- to_cypher = to ? "(to:`#{to}`)" : "(to)"
184
+ to_cypher = to ? "(to:`#{to}`)" : '(to)'
186
185
  type = "[r:`#{value[:type]}`]"
187
186
  where, phrase_start = action_variables(action, 'r')
188
187
  output "#{phrase_start} _classname '#{label}' where type is '#{value[:type]}' using cypher:"
@@ -191,7 +190,7 @@ module Neo4j
191
190
 
192
191
  def execute_cypher(query_string)
193
192
  output "Modified #{Neo4j::Session.query(query_string).first.modified} records"
194
- output ""
193
+ output ''
195
194
  end
196
195
 
197
196
  def action_variables(action, identifier)
@@ -201,7 +200,7 @@ module Neo4j
201
200
  when 'add'
202
201
  ["WHERE NOT HAS(#{identifier}._classname)", 'Adding']
203
202
  else
204
- raise "Invalid action #{action} specified"
203
+ fail "Invalid action #{action} specified"
205
204
  end
206
205
  end
207
206
  end
@@ -18,8 +18,8 @@ module Neo4j
18
18
  Paginated.new(ordered_partial, ordered_source, page)
19
19
  end
20
20
 
21
- delegate :each, :to => :items
22
- delegate :pluck, :to => :items
23
- delegate :size, :[], :to => :items
21
+ delegate :each, to: :items
22
+ delegate :pluck, to: :items
23
+ delegate :size, :[], to: :items
24
24
  end
25
- end
25
+ end
@@ -6,8 +6,8 @@ module Neo4j
6
6
  config.neo4j = ActiveSupport::OrderedOptions.new
7
7
 
8
8
  # Add ActiveModel translations to the I18n load_path
9
- initializer "i18n" do |app|
10
- config.i18n.load_path += Dir[File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'locales', '*.{rb,yml}')]
9
+ initializer 'i18n' do
10
+ config.i18n.load_path += Dir[File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'locales', '*.{rb,yml}')]
11
11
  end
12
12
 
13
13
  rake_tasks do
@@ -20,19 +20,19 @@ module Neo4j
20
20
  RUBY_PLATFORM =~ /java/
21
21
  end
22
22
 
23
- def set_default_session(cfg)
23
+ def setup_default_session(cfg)
24
24
  cfg.session_type ||= :server_db
25
- cfg.session_path ||= "http://localhost:7474"
25
+ cfg.session_path ||= 'http://localhost:7474'
26
26
  cfg.session_options ||= {}
27
27
  cfg.sessions ||= []
28
28
 
29
29
  unless (uri = URI(cfg.session_path)).user.blank?
30
- cfg.session_options.reverse_merge!({ basic_auth: { username: uri.user, password: uri.password } })
30
+ cfg.session_options.reverse_merge!(basic_auth: {username: uri.user, password: uri.password})
31
31
  cfg.session_path = cfg.session_path.gsub("#{uri.user}:#{uri.password}@", '')
32
32
  end
33
33
 
34
34
  if cfg.sessions.empty?
35
- cfg.sessions << { type: cfg.session_type, path: cfg.session_path, options: cfg.session_options }
35
+ cfg.sessions << {type: cfg.session_type, path: cfg.session_path, options: cfg.session_options}
36
36
  end
37
37
  end
38
38
 
@@ -46,40 +46,40 @@ module Neo4j
46
46
  session.start
47
47
  end
48
48
 
49
- def open_neo4j_session(session_opts)
50
- if !java_platform? && session_opts[:type] == :embedded_db
51
- raise "Tried to start embedded Neo4j db without using JRuby (got #{RUBY_PLATFORM}), please run `rvm jruby`"
49
+ def open_neo4j_session(options)
50
+ type, name, default, path = options.values_at(:type, :name, :default, :path)
51
+
52
+ if !java_platform? && type == :embedded_db
53
+ fail "Tried to start embedded Neo4j db without using JRuby (got #{RUBY_PLATFORM}), please run `rvm jruby`"
52
54
  end
53
55
 
54
- session = if session_opts.key?(:name)
55
- Neo4j::Session.open_named(session_opts[:type], session_opts[:name], session_opts[:default], session_opts[:path])
56
+ session = if options.key?(:name)
57
+ Neo4j::Session.open_named(type, name, default, path)
56
58
  else
57
- Neo4j::Session.open(session_opts[:type], session_opts[:path], session_opts[:options])
59
+ Neo4j::Session.open(type, path, options[:options])
58
60
  end
59
61
 
60
- start_embedded_session(session) if session_opts[:type] == :embedded_db
62
+ start_embedded_session(session) if type == :embedded_db
61
63
  end
62
-
63
64
  end
64
65
 
65
66
  # Starting Neo after :load_config_initializers allows apps to
66
67
  # register migrations in config/initializers
67
- initializer "neo4j.start", :after => :load_config_initializers do |app|
68
+ initializer 'neo4j.start', after: :load_config_initializers do |app|
68
69
  cfg = app.config.neo4j
69
70
  # Set Rails specific defaults
70
- Neo4j::Railtie.set_default_session(cfg)
71
+ Neo4j::Railtie.setup_default_session(cfg)
71
72
 
72
73
  cfg.sessions.each do |session_opts|
73
74
  Neo4j::Railtie.open_neo4j_session(session_opts)
74
75
  end
75
- Neo4j::Config.setup.merge!(cfg.to_hash)
76
+ Neo4j::Config.configuration.merge!(cfg.to_hash)
76
77
 
77
78
  clear = "\e[0m"
78
- red = "\e[31m"
79
79
  yellow = "\e[33m"
80
80
  cyan = "\e[36m"
81
81
 
82
- ActiveSupport::Notifications.subscribe('neo4j.cypher_query') do |name, start, finish, id, payload|
82
+ ActiveSupport::Notifications.subscribe('neo4j.cypher_query') do |_, start, finish, _id, payload|
83
83
  ms = (finish - start) * 1000
84
84
  Rails.logger.info " #{cyan}#{payload[:context]}#{clear} #{yellow}#{ms.round}ms#{clear} #{payload[:cypher]}" + (payload[:params].size > 0 ? ' | ' + payload[:params].inspect : '')
85
85
  end