Class: Neo4j::Core::CypherSession::Responses::Driver

Inherits:
Base
  • Object
show all
Defined in:
lib/neo4j/core/cypher_session/responses/driver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#each

Constructor Details

#initialize(responses, options = {}) ⇒ Driver

Returns a new instance of Driver.



10
11
12
13
14
# File 'lib/neo4j/core/cypher_session/responses/driver.rb', line 10

def initialize(responses, options = {})
  @wrap_level = options[:wrap_level] || Neo4j::Core::Config.wrapping_level

  @results = responses.map(&method(:result_from_data))
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



8
9
10
# File 'lib/neo4j/core/cypher_session/responses/driver.rb', line 8

def results
  @results
end

Instance Method Details

#result_from_data(entities_data) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/neo4j/core/cypher_session/responses/driver.rb', line 16

def result_from_data(entities_data)
  rows = entities_data.map do |entity_data|
    wrap_value(entity_data.values)
  end

  Neo4j::Core::CypherSession::Result.new(entities_data.keys, rows)
end

#wrap_by_level(none_proc) ⇒ Object



24
25
26
# File 'lib/neo4j/core/cypher_session/responses/driver.rb', line 24

def wrap_by_level(none_proc)
  super(@wrap_level == :none ? none_proc.call : nil)
end