Sha256: 4715537d427271e85e32aef996ab3b143ee46c713e83dcffeb04fb0f3a315618

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

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


org.neo4j.kernel.impl.core.IntArrayIterator.class_eval do
  def each_wrapped
    while(hasNext())
      yield self.next().wrapper
    end
  end

  def wrapped
    Enumerator.new(self, :each_wrapped)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neo4j-1.0.0.beta.27-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.26-java lib/neo4j/to_java.rb
neo4j-1.0.0.beta.25-java lib/neo4j/to_java.rb