Sha256: cb21cf697859dfbed386cbcd322601bbe3092d6e12c6047b971d9daba79fc836

Contents?: true

Size: 723 Bytes

Versions: 7

Compression:

Stored size: 723 Bytes

Contents

# This file defines a mixin to be used by classes that want to act as listners implementing the org.neo4j.gis.spatial.Listener interface

module Neo4j
  module Spatial
    module Listener
      include org.neo4j.gis.spatial.Listener
      def initialize(dbpath=nil)
        @work = 100
        @worked = 0
      end
      def begin(units_of_work)
        @work = units_of_work
        @work = 100 if(@work<1)
        @worked = 0
      end
      def worked(worked_since_last_notification)
        @worked += worked_since_last_notification
        progress
      end
      def done
        @worked = @work
        progress
      end
      def progress
        puts "#{100*@worked/@work}% #{self}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
neo4j-spatial-0.0.8-java lib/neo4j/spatial/listener.rb
neo4j-spatial-0.0.7-java lib/neo4j/spatial/listener.rb
neo4j-spatial-0.0.6-java lib/neo4j/spatial/listener.rb
neo4j-spatial-0.0.5-java lib/neo4j/spatial/listener.rb
neo4j-spatial-0.0.4-java lib/neo4j/spatial/listener.rb
neo4j-spatial-0.0.2-java lib/neo4j/spatial/listener.rb
neo4j-spatial-0.0.1-java lib/neo4j/spatial/listener.rb