Sha256: 8c23cc8f289c2317b91e81dbca7b6b70d97bf21c6d97a85690c37ab1b484a051

Contents?: true

Size: 859 Bytes

Versions: 6

Compression:

Stored size: 859 Bytes

Contents

module Neo4j
  module ToJava

    def type_to_java(type)
      org.neo4j.graphdb.DynamicRelationshipType.withName(type.to_s)
    end

    def type_from_java(type)
      type.get_type
    end

    def dir_from_java(dir)
      case dir
        when org.neo4j.graphdb.Direction::OUTGOING then :outgoing
        when org.neo4j.graphdb.Direction::BOTH     then :both
        when org.neo4j.graphdb.Direction::INCOMING then :incoming
        else raise "unknown direction '#{dir} / #{dir.class}'"
      end
    end

    def dir_to_java(dir)
      case dir
        when :outgoing then org.neo4j.graphdb.Direction::OUTGOING
        when :both     then org.neo4j.graphdb.Direction::BOTH
        when :incoming then org.neo4j.graphdb.Direction::INCOMING
        else raise "unknown direction '#{dir}', expects :outgoing, :incoming or :both"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
neo4j-1.0.0-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.32-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.31-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.30-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.29-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.28-java lib/neo4j/to_java.rb