Module: Promise::Progress
- Included in:
- Promise
- Defined in:
- lib/promise/progress.rb
Instance Method Summary collapse
Instance Method Details
#on_progress(&block) ⇒ Object
5 6 7 8 9 |
# File 'lib/promise/progress.rb', line 5 def on_progress(&block) (@on_progress ||= []).tap do |callbacks| callbacks << block if block_given? end end |
#progress(status) ⇒ Object
11 12 13 14 15 |
# File 'lib/promise/progress.rb', line 11 def progress(status) if pending? on_progress.each { |block| block.call(status) } end end |