Class: Neo4j::Server::CypherResponse::HashEnumeration
- Inherits:
-
Object
- Object
- Neo4j::Server::CypherResponse::HashEnumeration
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/neo4j-server/cypher_response.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(response, query) ⇒ HashEnumeration
constructor
A new instance of HashEnumeration.
- #inspect ⇒ Object
- #struct_rows(row) ⇒ Object
- #to_s ⇒ Object
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
#each ⇒ Object
40 41 42 |
# File 'lib/neo4j-server/cypher_response.rb', line 40 def each @response.each_data_row { |row| yield struct_rows(row) } end |
#inspect ⇒ Object
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_s ⇒ Object
32 33 34 |
# File 'lib/neo4j-server/cypher_response.rb', line 32 def to_s @query end |