Class: Neo4j::Http::Results
- Inherits:
-
Object
- Object
- Neo4j::Http::Results
- Defined in:
- lib/neo4j/http/results.rb
Class Method Summary collapse
-
.parse(results) ⇒ Object
Example result set: [href=""n"">columns”=>, “data”=> [{“row”=>[{“name”=>“Foo”, “uuid”=>“8c7dcfda-d848-4937-a91a-2e6debad2dd6”], “meta”=>[“type”=>“node”, “deleted”=>false]}]}].
Class Method Details
.parse(results) ⇒ Object
Example result set: [href=""n"">columns”=>, “data”=> [{“row”=>[{“name”=>“Foo”, “uuid”=>“8c7dcfda-d848-4937-a91a-2e6debad2dd6”],
"meta"=>[{"id"=>242, "type"=>"node", "deleted"=>false}]}]}]
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/neo4j/http/results.rb', line 12 def self.parse(results) columns = results["columns"] data = results["data"] data.map do |result| row = result["row"] || [] = result["meta"] || [] compacted_data = row.each_with_index.map do |attributes, index| = [index] || {} attributes["_neo4j_meta_data"] = if attributes.is_a?(Hash) attributes end columns.zip(compacted_data).to_h.with_indifferent_access end end |