Sha256: 328567f93505b52c684b48c0d8f8d525c1d57e3cc1307a9f6254aee079117c2b

Contents?: true

Size: 1.28 KB

Versions: 33

Compression:

Stored size: 1.28 KB

Contents

module Neo4j::Embedded
  # 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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
neo4j-core-3.1.1 lib/neo4j-embedded/to_java.rb
neo4j-core-3.1.0 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.8 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.7 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.6 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.5 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.4 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.3 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.2 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.1 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.rc.5 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.rc.4 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.rc.1 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.alpha.19 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.alpha.18 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.alpha.17 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.alpha.16 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.alpha.15 lib/neo4j-embedded/to_java.rb
neo4j-core-3.0.0.alpha.14 lib/neo4j-embedded/to_java.rb