Class: Neo4j::Server::CypherResponse::HashEnumeration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/neo4j-server/cypher_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response, query) ⇒ HashEnumeration

Returns a new instance of HashEnumeration.



26
27
28
29
# File 'lib/neo4j-server/cypher_response.rb', line 26

def initialize(response, query)
  @response = response
  @query = query
end

Instance Method Details

#each(&block) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/neo4j-server/cypher_response.rb', line 39

def each(&block)
  @response.each_data_row do |row|
    yield(row.each_with_index.each_with_object(struct.new) do |(value, i), result|
      result[columns[i].to_sym] = value
    end)
  end
end

#inspectObject



35
36
37
# File 'lib/neo4j-server/cypher_response.rb', line 35

def inspect
  "Enumerable query: '#{@query}'"
end

#to_sObject



31
32
33
# File 'lib/neo4j-server/cypher_response.rb', line 31

def to_s
  @query
end