neo4j-core 5.0.7 → 5.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55656e36d264c6992ce85e4c43cf9e8ed608e838
4
- data.tar.gz: df30a6b7b0487cc343e333ed468db3b96fe424fe
3
+ metadata.gz: 51b5f49436107e6cb6e21dab6fbcaf3ab9b34d7e
4
+ data.tar.gz: 2d5abdedb5801e570b574be1c11775205f0f02dc
5
5
  SHA512:
6
- metadata.gz: 82baa7afbcef3d6f046fa582a573c213644c1dd56161f284e70abbee5c55a586f4949e34a8c421c1c7d582a59e7554801c56bc4886714e605a0102294cc99ca2
7
- data.tar.gz: 2cd170839c8eb27160a774e050cb75f94a5efb3cffa6b2758ecf0fdf571384e8df5f87bfa347e25cfd21703aa8495f11650bb316b68275557b2df8b2f70ff14b
6
+ metadata.gz: 743eb5fe7dade48408e0d6f960c2889d1b44bf383da67ac6f9550932b3ba69f5157aadd5acab38807124317b7f0bca7641e63481d0af205a7320d3401cb452f4
7
+ data.tar.gz: 06a8b66c2b710bbc47d5ceeb2627eaa7224653e377265a331baa01bbbf4f5d23c5f78c0f9af2a86d012c2429eecc06a48b2aff52018ac14626831050ab4f3f5f
@@ -141,12 +141,16 @@ module Neo4j
141
141
  end
142
142
  end
143
143
 
144
+ def self.paramaterize_key!(key)
145
+ key.tr_s!('^a-zA-Z0-9', UNDERSCORE)
146
+ key.gsub!(/^_+|_+$/, '')
147
+ end
148
+
144
149
  private
145
150
 
146
151
  def key_value_string(key, value, previous_keys = [], is_set = false)
147
152
  param = (previous_keys << key).join(UNDERSCORE)
148
- param.tr_s!('^a-zA-Z0-9', UNDERSCORE)
149
- param.gsub!(/^_+|_+$/, '')
153
+ self.class.paramaterize_key!(param)
150
154
 
151
155
  if value.is_a?(Range)
152
156
  add_params("#{param}_range_min" => value.min, "#{param}_range_max" => value.max)
@@ -237,7 +241,7 @@ module Neo4j
237
241
  case value
238
242
  when Hash then hash_key_value_string(key, value, previous_keys)
239
243
  when NilClass then "#{key} IS NULL"
240
- when Regexp then regexp_key_value_string(key, value)
244
+ when Regexp then regexp_key_value_string(key, value, previous_keys)
241
245
  when Array, Range then key_value_string(key, value, previous_keys)
242
246
  else
243
247
  key_value_string(key, value, previous_keys)
@@ -263,9 +267,15 @@ module Neo4j
263
267
  end.join(AND)
264
268
  end
265
269
 
266
- def regexp_key_value_string(key, value)
270
+ def regexp_key_value_string(key, value, previous_keys)
267
271
  pattern = (value.casefold? ? '(?i)' : '') + value.source
268
- "#{key} =~ #{escape_value(pattern.gsub(/\\/, '\\\\\\'))}"
272
+
273
+ param = [previous_keys + [key]].join(UNDERSCORE)
274
+ self.class.paramaterize_key!(param)
275
+
276
+ add_params(param => pattern)
277
+
278
+ "#{key} =~ {#{param}}"
269
279
  end
270
280
 
271
281
  class << self
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Core
3
- VERSION = '5.0.7'
3
+ VERSION = '5.0.8'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.7
4
+ version: 5.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Chris Grigg, Brian Underwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-03 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -262,7 +262,6 @@ files:
262
262
  - lib/neo4j-core.rb
263
263
  - lib/neo4j-core/active_entity.rb
264
264
  - lib/neo4j-core/cypher_translator.rb
265
- - lib/neo4j-core/graph_json.rb
266
265
  - lib/neo4j-core/hash_with_indifferent_access.rb
267
266
  - lib/neo4j-core/helpers.rb
268
267
  - lib/neo4j-core/label.rb
@@ -1,35 +0,0 @@
1
- module Neo4j
2
- module Core
3
- module GraphJSON
4
- def self.to_graph_json(objects)
5
- nodes = {}
6
- edges = {}
7
-
8
- objects.each do |object|
9
- case object
10
- when Neo4j::ActiveNode, Neo4j::Server::CypherNode
11
- nodes[object.neo_id] = {
12
- id: object.neo_id,
13
- labels: (object.is_a?(Neo4j::ActiveNode) ? [object.class.name] : object.labels),
14
- properties: object.attributes
15
- }
16
- when Neo4j::ActiveRel, Neo4j::Server::CypherRelationship
17
- edges[[object.start_node.neo_id, object.end_node.neo_id]] = {
18
- source: object.start_node.neo_id,
19
- target: object.end_node.neo_id,
20
- type: object.rel_type,
21
- properties: object.props
22
- }
23
- else
24
- fail "Invalid value found: #{object.inspect}"
25
- end
26
- end
27
-
28
- {
29
- nodes: nodes.values,
30
- edges: edges.values
31
- }.to_json
32
- end
33
- end
34
- end
35
- end