Class: Neo4j::Core::QueryClauses::CreateClause
- Defined in:
- lib/neo4j-core/query_clauses.rb
Direct Known Subclasses
Constant Summary collapse
- KEYWORD =
'CREATE'
Constants inherited from Clause
Neo4j::Core::QueryClauses::Clause::AND, Neo4j::Core::QueryClauses::Clause::COMMA_SPACE, Neo4j::Core::QueryClauses::Clause::UNDERSCORE
Constants included from CypherTranslator
CypherTranslator::EMPTY_PROPS, CypherTranslator::SANITIZE_ESCAPED_REGEXP
Instance Attribute Summary
Attributes inherited from Clause
Class Method Summary collapse
Instance Method Summary collapse
- #from_hash(hash) ⇒ Object
- #from_key_and_value(key, value) ⇒ Object
- #from_string(value) ⇒ Object
- #from_symbol(value) ⇒ Object
Methods inherited from Clause
#_nested_value_hash?, #_use_key_for_var?, #attributes_from_key_and_value, from_arg, from_args, #initialize, keyword, keyword_downcase, #label_from_key_and_value, #node_from_key_and_value, to_cypher, #value, #var_from_key_and_value
Methods included from CypherTranslator
#create_escape_value, #cypher_prop_list!, #cypher_string, #escape_quotes, #escape_value, #label_string, #prop_identifier, #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
379 380 381 |
# File 'lib/neo4j-core/query_clauses.rb', line 379 def clause_string(clauses) clauses.map!(&:value).join(', ') end |
Instance Method Details
#from_hash(hash) ⇒ Object
364 365 366 367 368 369 370 371 372 |
# File 'lib/neo4j-core/query_clauses.rb', line 364 def from_hash(hash) if hash.values.any? { |value| value.is_a?(Hash) } hash.map do |key, value| from_key_and_value(key, value) end else "(#{attributes_string(hash)})" end end |
#from_key_and_value(key, value) ⇒ Object
374 375 376 |
# File 'lib/neo4j-core/query_clauses.rb', line 374 def from_key_and_value(key, value) node_from_key_and_value(key, value, prefer: :label) end |
#from_string(value) ⇒ Object
356 357 358 |
# File 'lib/neo4j-core/query_clauses.rb', line 356 def from_string(value) value end |
#from_symbol(value) ⇒ Object
360 361 362 |
# File 'lib/neo4j-core/query_clauses.rb', line 360 def from_symbol(value) "(:#{value})" end |