Sha256: f6367c4d282422789f9d967614a07d5aa6bfcb5e0ab74fb781bed659d598a5b9

Contents?: true

Size: 308 Bytes

Versions: 3

Compression:

Stored size: 308 Bytes

Contents

# encoding: utf-8

class Promise
  module Progress
    def initialize
      super
      @on_progress = []
    end

    def on_progress(&block)
      @on_progress << block
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
promise.rb-0.3.0 lib/promise/progress.rb
promise.rb-0.2.1 lib/promise/progress.rb
promise.rb-0.2.0 lib/promise/progress.rb