Class: Neo4j::Core::Traversal::Evaluator
- Inherits:
-
Object
- Object
- Neo4j::Core::Traversal::Evaluator
- Includes:
- Java::OrgNeo4jGraphdbTraversal::Evaluator
- Defined in:
- lib/neo4j-core/traversal/evaluator.rb
Overview
Implements the Neo4j Evaluator Java interface, only used internally.
Instance Method Summary collapse
-
#evaluate(path) ⇒ Object
Implements the Java Interface: evaluate(Path path) Evaluates a Path and returns an Evaluation containing information about whether or not to include it in the traversal result, i.e return it from the Traverser.
-
#initialize(&eval_block) ⇒ Evaluator
constructor
A new instance of Evaluator.
Constructor Details
#initialize(&eval_block) ⇒ Evaluator
Returns a new instance of Evaluator.
10 11 12 |
# File 'lib/neo4j-core/traversal/evaluator.rb', line 10 def initialize(&eval_block) @eval_block = eval_block end |
Instance Method Details
#evaluate(path) ⇒ Object
Implements the Java Interface:
evaluate(Path path)
Evaluates a Path and returns an Evaluation containing information about whether or not to include it in the traversal result, i.e return it from the Traverser.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/neo4j-core/traversal/evaluator.rb', line 17 def evaluate(path) ret = @eval_block.call(path) case ret when :exclude_and_continue then Java::OrgNeo4jGraphdbTraversal::Evaluation::EXCLUDE_AND_CONTINUE when :exclude_and_prune then Java::OrgNeo4jGraphdbTraversal::Evaluation::EXCLUDE_AND_PRUNE when :include_and_continue then Java::OrgNeo4jGraphdbTraversal::Evaluation::INCLUDE_AND_CONTINUE when :include_and_prune then Java::OrgNeo4jGraphdbTraversal::Evaluation::INCLUDE_AND_PRUNE else raise "Got #{ret}, only accept :exclude_and_continue,:exclude_and_prune,:include_and_continue and :include_and_prune" end end |