Sha256: 5e18d298cd67972af376b50e47aaec322573849e54c840fadac69f0b580cf3d6

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

require 'sequel'
require 'tqdm'

# @see Sequel::Dataset
module Sequel

  # In order to use `Tqdm` with Sequel Datasets, we can simply extend `Sequel::Dataset`
  # with the same `#with_progress` method
  #
  # @see Enumerable#with_progress
  # @see http://sequel.jeremyevans.net/
  # @see http://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html
  class Dataset

    # Returns a clone of `self` where all calls to `#each` and related methods will print an animated progress bar
    # while iterating.
    #
    # @param options [Hash] options are the same as Enumerable#with_progress
    #
    # @see Enumerable#with_progress
    def with_progress(options = {})
      Tqdm::Decorator.new(self, options).enhance
    end
    alias :tqdm :with_progress

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tqdm-0.4.1 lib/tqdm/sequel.rb
tqdm-0.4.0 lib/tqdm/sequel.rb
tqdm-0.3.0 lib/tqdm/sequel.rb
tqdm-0.2.0 lib/tqdm/sequel.rb