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.



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

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

Instance Method Details

#eachObject



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

def each
  @response.each_data_row { |row| yield struct_rows(row) }
end

#inspectObject



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

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

#struct_rows(row) ⇒ Object



44
45
46
47
48
# File 'lib/neo4j-server/cypher_response.rb', line 44

def struct_rows(row)
  struct.new.tap do |result|
    row.each_with_index { |value, i| result[columns[i]] = value }
  end
end

#to_sObject



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

def to_s
  @query
end