class Neo4j::Core::Query

DSL for generating Cypher queries and enumerating their results.

@see www.rubydoc.info/gems/neo4j-core/Neo4j/Core/Query

Attributes

session[R]

Exports the underlying session handle. @return [Neo4j::Session]

Public Instance Methods

each() { |Hash| ... } click to toggle source
# File lib/rom/neo4j/support/core_ext.rb, line 14
def each
  return enum_for(:each) unless block_given?

  response = self.response
  columns = response.columns.map { |c| c.to_sym }

  if response.is_a?(Neo4j::Server::CypherResponse)
    response.data.map do |row|
      yield Hash[columns.zip(row)]
    end
  else
    raise Neo4j::Core::UnsupportedDriver, 'Neo4j::Embedded is not supported (yet)'
  end
end