Sha256: 4e17ac8e0797cac42574cbda77ba6422b4bbc4389297246093f2b2c8a178e6a9

Contents?: true

Size: 833 Bytes

Versions: 8

Compression:

Stored size: 833 Bytes

Contents

module Neo4j
  module Core
    module Traversal
      # Implements the Neo4j RelationshipExpander Java interface, only used internally.
      # @private
      class RelExpander
        include Java::OrgNeo4jGraphdb::PathExpander

        attr_accessor :reversed, :reverse

        def initialize(&block)
          @block = block
          @reversed = false
        end

        def self.create_pair(&block)
          normal = RelExpander.new(&block)
          reversed = RelExpander.new(&block)
          normal.reverse = reversed
          reversed.reversed = normal
          reversed.reverse!
          normal
        end

        def expand(node, _)
          @block.arity == 1 ? @block.call(node) : @block.call(node, @reversed)
        end

        def reverse!
          @reversed = true
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
neo4j-core-2.3.0-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.2.4-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.2.3-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.2.2-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.2.1-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.2.0-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.2.0.rc1-java lib/neo4j-core/traversal/rel_expander.rb
neo4j-core-2.1.0-java lib/neo4j-core/traversal/rel_expander.rb