Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

YARD

  • Loading branch information...
commit 49d50c72122c9f7d4cafb424d1b24218702de7cf 1 parent 4c2b98e
@andreasronge andreasronge authored
Showing with 15 additions and 4 deletions.
  1. +2 −0  .yardopts
  2. +13 −4 lib/neo4j-core/cypher/result_wrapper.rb
View
2  .yardopts
@@ -0,0 +1,2 @@
+--title 'Neo4j::Core API Documentation'
+--no-private
View
17 lib/neo4j-core/cypher/result_wrapper.rb
@@ -1,12 +1,21 @@
module Neo4j
module Core
module Cypher
- # Wraps the Cypher query result
- # Loads the wrapper if possible and use symbol as keys.
+ # Wraps the Cypher query result.
+ # Loads the node and relationships wrapper if possible and use symbol as column keys.
+ # @notice The result is a once forward read only Enumerable, work if you need to read the result twice - use #to_a
+ #
+ # @example
+ # result = Neo4j.query(@a, @b){|a,b| node(a,b).as(:n)}
+ # r = @query_result.to_a # can only loop once
+ # r.size.should == 2
+ # r.first.should include(:n)
+ # r[0][:n].neo_id.should == @a.neo_id
+ # r[1][:n].neo_id.should == @b.neo_id
class ResultWrapper
include Enumerable
- # @return the original result from the Neo4j Cypher Engine
+ # @return the original result from the Neo4j Cypher Engine, once forward read only !
attr_reader :source
def initialize(source)
@@ -23,7 +32,7 @@ def each
@source.each { |row| yield map(row) }
end
- # Maps each row
+ # Maps each row so that we can use symbols for column names.
# @private
def map(row)
out = {} # move to a real hash!
Please sign in to comment.
Something went wrong with that request. Please try again.