neo4j-core 5.0.1 → 5.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.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/README.md +32 -6
- data/lib/neo4j/ansi.rb +14 -0
- data/lib/neo4j/label.rb +0 -1
- data/lib/neo4j/node.rb +6 -1
- data/lib/neo4j-core/helpers.rb +2 -7
- data/lib/neo4j-core/query.rb +38 -7
- data/lib/neo4j-core/query_clauses.rb +186 -57
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-core.rb +1 -1
- data/lib/neo4j-embedded/embedded_session.rb +18 -10
- data/lib/neo4j-embedded.rb +1 -1
- data/lib/neo4j-server/cypher_node.rb +8 -6
- data/lib/neo4j-server/cypher_relationship.rb +11 -5
- data/lib/neo4j-server/cypher_response.rb +9 -6
- data/lib/neo4j-server/cypher_session.rb +29 -25
- data/lib/neo4j-server/cypher_transaction.rb +0 -1
- data/lib/neo4j-server.rb +0 -1
- data/neo4j-core.gemspec +1 -2
- metadata +7 -25
- data/lib/neo4j/tasks/config_server.rb +0 -36
- data/lib/neo4j/tasks/neo4j_server.rake +0 -245
- data/lib/neo4j-core/cypher_translator.rb +0 -76
- data/lib/neo4j-core/hash_with_indifferent_access.rb +0 -174
- data/lib/neo4j-server/cypher_node_uncommited.rb +0 -14
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
module Neo4j
|
|
2
|
-
module Core
|
|
3
|
-
# Stolen from http://as.rubyonrails.org/classes/HashWithIndifferentAccess.html
|
|
4
|
-
# We don't want to depend on active support
|
|
5
|
-
class HashWithIndifferentAccess < Hash
|
|
6
|
-
# Always returns true, so that <tt>Array#extract_options!</tt> finds members of this class.
|
|
7
|
-
def extractable_options?
|
|
8
|
-
true
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def with_indifferent_access
|
|
12
|
-
dup
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def nested_under_indifferent_access
|
|
16
|
-
self
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def initialize(constructor = {})
|
|
20
|
-
if constructor.is_a?(Hash)
|
|
21
|
-
super()
|
|
22
|
-
update(constructor)
|
|
23
|
-
else
|
|
24
|
-
super(constructor)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def default(key = nil)
|
|
29
|
-
if key.is_a?(Symbol) && include?(key = key.to_s)
|
|
30
|
-
self[key]
|
|
31
|
-
else
|
|
32
|
-
super
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.new_from_hash_copying_default(hash)
|
|
37
|
-
new(hash).tap do |new_hash|
|
|
38
|
-
new_hash.default = hash.default
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
|
|
43
|
-
alias_method :regular_update, :update unless method_defined?(:regular_update)
|
|
44
|
-
|
|
45
|
-
# Assigns a new value to the hash:
|
|
46
|
-
#
|
|
47
|
-
# hash = HashWithIndifferentAccess.new
|
|
48
|
-
# hash[:key] = "value"
|
|
49
|
-
#
|
|
50
|
-
def []=(key, value)
|
|
51
|
-
regular_writer(convert_key(key), convert_value(value))
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
alias_method :store, :[]=
|
|
55
|
-
|
|
56
|
-
# Updates the instantized hash with values from the second:
|
|
57
|
-
#
|
|
58
|
-
# hash_1 = HashWithIndifferentAccess.new
|
|
59
|
-
# hash_1[:key] = "value"
|
|
60
|
-
#
|
|
61
|
-
# hash_2 = HashWithIndifferentAccess.new
|
|
62
|
-
# hash_2[:key] = "New Value!"
|
|
63
|
-
#
|
|
64
|
-
# hash_1.update(hash_2) # => {"key"=>"New Value!"}
|
|
65
|
-
#
|
|
66
|
-
def update(other_hash)
|
|
67
|
-
if other_hash.is_a? HashWithIndifferentAccess
|
|
68
|
-
super(other_hash)
|
|
69
|
-
else
|
|
70
|
-
other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
|
|
71
|
-
self
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
alias_method :merge!, :update
|
|
76
|
-
|
|
77
|
-
# Checks the hash for a key matching the argument passed in:
|
|
78
|
-
#
|
|
79
|
-
# hash = HashWithIndifferentAccess.new
|
|
80
|
-
# hash["key"] = "value"
|
|
81
|
-
# hash.key? :key # => true
|
|
82
|
-
# hash.key? "key" # => true
|
|
83
|
-
#
|
|
84
|
-
def key?(key)
|
|
85
|
-
super(convert_key(key))
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
alias_method :include?, :key?
|
|
89
|
-
alias_method :has_key?, :key?
|
|
90
|
-
alias_method :member?, :key?
|
|
91
|
-
|
|
92
|
-
# Fetches the value for the specified key, same as doing hash[key]
|
|
93
|
-
def fetch(key, *extras)
|
|
94
|
-
super(convert_key(key), *extras)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# Returns an array of the values at the specified indices:
|
|
98
|
-
#
|
|
99
|
-
# hash = HashWithIndifferentAccess.new
|
|
100
|
-
# hash[:a] = "x"
|
|
101
|
-
# hash[:b] = "y"
|
|
102
|
-
# hash.values_at("a", "b") # => ["x", "y"]
|
|
103
|
-
#
|
|
104
|
-
def values_at(*indices)
|
|
105
|
-
indices.collect { |key| self[convert_key(key)] }
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
# Returns an exact copy of the hash.
|
|
109
|
-
def dup
|
|
110
|
-
self.class.new(self).tap do |new_hash|
|
|
111
|
-
new_hash.default = default
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# Merges the instantized and the specified hashes together, giving precedence to the values from the second hash.
|
|
116
|
-
# Does not overwrite the existing hash.
|
|
117
|
-
def merge(hash)
|
|
118
|
-
dup.update(hash)
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
# Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
|
|
122
|
-
# This overloaded definition prevents returning a regular hash, if reverse_merge is called on a <tt>HashWithDifferentAccess</tt>.
|
|
123
|
-
def reverse_merge(other_hash)
|
|
124
|
-
super self.class.new_from_hash_copying_default(other_hash)
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def reverse_merge!(other_hash)
|
|
128
|
-
replace(reverse_merge(other_hash))
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Removes a specified key from the hash.
|
|
132
|
-
def delete(key)
|
|
133
|
-
super(convert_key(key))
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
def stringify_keys!
|
|
137
|
-
self
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def stringify_keys
|
|
141
|
-
dup
|
|
142
|
-
end
|
|
143
|
-
# undef :symbolize_keys!
|
|
144
|
-
def symbolize_keys
|
|
145
|
-
to_hash.symbolize_keys
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
def to_options!
|
|
149
|
-
self
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
# Convert to a Hash with String keys.
|
|
153
|
-
def to_hash
|
|
154
|
-
Hash.new(default).merge!(self)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
protected
|
|
158
|
-
|
|
159
|
-
def convert_key(key)
|
|
160
|
-
key.is_a?(Symbol) ? key.to_s : key
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def convert_value(value)
|
|
164
|
-
if value.is_a? Hash
|
|
165
|
-
value # .nested_under_indifferent_access
|
|
166
|
-
elsif value.is_a?(Array)
|
|
167
|
-
value.dup.replace(value.map { |e| convert_value(e) })
|
|
168
|
-
else
|
|
169
|
-
value
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
end
|