Class: Neo4j::Core::QueryClauses::WhereClause
- Defined in:
- lib/neo4j-core/query_clauses.rb
Constant Summary
Constants included from CypherTranslator
CypherTranslator::SANITIZE_ESCAPED_REGEXP
Instance Attribute Summary
Attributes inherited from Clause
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Clause
from_args, #from_string, #initialize, #node_from_key_and_value, to_cypher, #value
Methods included from CypherTranslator
#cypher_prop_list, #escape_quotes, #escape_value, #sanitize_escape_sequences, sanitized_column_names, translate_response
Constructor Details
This class inherits a constructor from Neo4j::Core::QueryClauses::Clause
Class Method Details
.clause_string(clauses) ⇒ Object
194 195 196 |
# File 'lib/neo4j-core/query_clauses.rb', line 194 def clause_string(clauses) clauses.map(&:value).join(' AND ') end |
Instance Method Details
#from_key_and_value(key, value, previous_keys = []) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/neo4j-core/query_clauses.rb', line 171 def from_key_and_value(key, value, previous_keys = []) case value when Hash value.map do |k, v| if k.to_sym == :neo_id "ID(#{key}) = #{v.to_i}" else key.to_s + '.' + from_key_and_value(k, v, previous_keys + [key]) end end.join(' AND ') when NilClass "#{key} IS NULL" when Regexp pattern = (value.casefold? ? "(?i)" : "") + value.source "#{key} =~ #{escape_value(pattern.gsub(/\\/, '\\\\\\'))}" when Array key_value_string(key, value, previous_keys) else key_value_string(key, value, previous_keys) end end |