Sha256: 67cf08225eb146f9ecd752939b47a88524f3a662726e4193977739895570811a
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
module Neo4jr # SEE: http://api.neo4j.org/current/org/neo4j/api/core/StopEvaluator.html class StopEvaluator DEPTH_ONE = org.neo4j.graphdb.StopEvaluator::DEPTH_ONE END_OF_GRAPH = org.neo4j.graphdb.StopEvaluator::END_OF_GRAPH END_OF_NETWORK = org.neo4j.graphdb.StopEvaluator::END_OF_NETWORK # Creates a new StopEvaluator on the fly that delgates to the passed in block to use with the traverse method. # The block should return either true or false # See http://api.neo4j.org/current/org/neo4j/api/core/StopEvaluator.html#isStopNode(org.neo4j.api.core.TraversalPosition) # # Examples: # # Stop.when do |current_position| # current_position.depth > 3 && current_position.previousNode[:active] == false # end # def self.when(&block) instance = new instance.instance_variable_set(:@evaluator_block, block) instance.instance_eval do def isStopNode(position) @evaluator_block.call(position) end end instance end # Creates a new StopEvaluator on the fly that will stop traversing the graph when the depth specified is reached # # Examples: # # Stop.at(4) # def self.at(depth) self.when do |position| position.depth >= depth end end end Stop = StopEvaluator end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neo4jr-simple-0.2.1 | lib/neo4jr/stop_evaluator.rb |
neo4jr-simple-0.2.0 | lib/neo4jr/stop_evaluator.rb |
neo4jr-simple-0.1.8 | lib/neo4jr/stop_evaluator.rb |