Sha256: 40f84ccd4559caa1f83b11a52e059bc81642470eeb0d54ba7dd6d35fbaa97208

Contents?: true

Size: 800 Bytes

Versions: 23

Compression:

Stored size: 800 Bytes

Contents

module Picky

  # Helper methods for measuring, benchmarking, logging.
  #
  module Helpers
    module Indexing

      include Measuring

      # Runs the block and logs a few infos regarding the time it took.
      #
      def timed_indexing scheduler, &block
        Picky.logger.info "Picky is indexing using #{scheduler.fork? ? 'multiple processes' : 'a single process'}: "
        Picky.logger.info " Done in #{timed(&block).round}s.\n"
      end

      # Indexing works the same way, always:
      #  * Prepare the scheduler.
      #  * Cache the scheduler.
      #
      def index scheduler = Scheduler.new
        timed_indexing scheduler do
          prepare scheduler
          scheduler.finish

          cache scheduler
          scheduler.finish
        end
      end

    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
picky-4.31.3 lib/picky/helpers/indexing.rb
picky-4.31.2 lib/picky/helpers/indexing.rb
picky-4.31.1 lib/picky/helpers/indexing.rb
picky-4.31.0 lib/picky/helpers/indexing.rb
picky-4.30.0 lib/picky/helpers/indexing.rb
picky-4.29.0 lib/picky/helpers/indexing.rb
picky-4.28.1 lib/picky/helpers/indexing.rb
picky-4.27.1 lib/picky/helpers/indexing.rb
picky-4.27.0 lib/picky/helpers/indexing.rb
picky-4.26.2 lib/picky/helpers/indexing.rb
picky-4.26.1 lib/picky/helpers/indexing.rb
picky-4.26.0 lib/picky/helpers/indexing.rb
picky-4.25.3 lib/picky/helpers/indexing.rb
picky-4.25.2 lib/picky/helpers/indexing.rb
picky-4.25.1 lib/picky/helpers/indexing.rb
picky-4.25.0 lib/picky/helpers/indexing.rb
picky-4.24.0 lib/picky/helpers/indexing.rb
picky-4.23.2 lib/picky/helpers/indexing.rb
picky-4.23.1 lib/picky/helpers/indexing.rb
picky-4.23.0 lib/picky/helpers/indexing.rb