Sha256: afcdc8a1580ceceece2af39412e761a65ca773362f78d4e650582b89c9a1c987

Contents?: true

Size: 304 Bytes

Versions: 4

Compression:

Stored size: 304 Bytes

Contents

# encoding: utf-8

class Promise
  module Progress
    def on_progress(&block)
      @on_progress ||= []
      @on_progress << block if block_given?
      @on_progress
    end

    def progress(status)
      if pending?
        on_progress.each { |block| block.call(status) }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
promise.rb-0.6.1 lib/promise/progress.rb
promise.rb-0.6.0 lib/promise/progress.rb
promise.rb-0.5.0 lib/promise/progress.rb
promise.rb-0.4.0 lib/promise/progress.rb