Sha256: 02e7872f2dcb27c04262d4a055290a14fe3b4d148cebea2e9d62370bfde2bcde

Contents?: true

Size: 1.36 KB

Versions: 28

Compression:

Stored size: 1.36 KB

Contents

module Neo4j
  module Core
    # A Utility class for translating Ruby object to Neo4j Java types
    # @private
    module ToJava
      def type_to_java(type)
        Java::OrgNeo4jGraphdb::DynamicRelationshipType.withName(type.to_s)
      end

      module_function :type_to_java

      def types_to_java(types)
        types.inject([]) { |result, type| result << type_to_java(type) }.to_java(Java::OrgNeo4jGraphdb::RelationshipType)
      end

      module_function :types_to_java


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

      module_function :dir_from_java

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

      module_function :dir_to_java

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
neo4j-core-2.3.0-java lib/neo4j-core/to_java.rb
neo4j-core-2.2.4-java lib/neo4j-core/to_java.rb
neo4j-core-2.2.3-java lib/neo4j-core/to_java.rb
neo4j-core-2.2.2-java lib/neo4j-core/to_java.rb
neo4j-core-2.2.1-java lib/neo4j-core/to_java.rb
neo4j-core-2.2.0-java lib/neo4j-core/to_java.rb
neo4j-core-2.2.0.rc1-java lib/neo4j-core/to_java.rb
neo4j-core-2.1.0-java lib/neo4j-core/to_java.rb
neo4j-core-2.0.1-java lib/neo4j-core/to_java.rb
neo4j-core-2.0.0-java lib/neo4j-core/to_java.rb
neo4j-core-2.0.0.rc2-java lib/neo4j-core/to_java.rb
neo4j-core-2.0.0.rc1-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.15-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.14-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.13-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.12-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.11-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.10-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.9-java lib/neo4j-core/to_java.rb
neo4j-core-0.0.8-java lib/neo4j-core/to_java.rb