Class: Neo4jr::ReturnableEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4jr/returnable_evaluator.rb

Overview

Constant Summary collapse

ALL =
org.neo4j.graphdb.ReturnableEvaluator.ALL
ALL_BUT_START_NODE =
org.neo4j.graphdb.ReturnableEvaluator.ALL_BUT_START_NODE

Class Method Summary collapse

Class Method Details

.everythingObject



28
29
30
31
32
# File 'lib/neo4jr/returnable_evaluator.rb', line 28

def self.everything
  self.when do |position|
    true
  end
end

.when(&block) ⇒ Object

Creates a new ReturnableEvaluator 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 api.neo4j.org/current/org/neo4j/api/core/ReturnableEvaluator.html#isReturnableNode(org.neo4j.api.core.TraversalPosition)

Examples:

Return.when do |current_position|
  current_position.depth > 3 && current_position.previousNode[:active] == false
end


17
18
19
20
21
22
23
24
25
26
# File 'lib/neo4jr/returnable_evaluator.rb', line 17

def self.when(&block)
  instance = new
  instance.instance_variable_set(:@evaluator_block, block)
  instance.instance_eval do
    def isReturnableNode(position)
      @evaluator_block.call(position)
    end
  end
  instance
end