Skip to content

Commit

Permalink
Refactor: Send All Progress Events To The Projector
Browse files Browse the repository at this point in the history
Why This Change Is Necessary
========================================================================

The projectors need to know when progress changes so that eventually it
will be able to update the projection each time it does.

What These Changes Do To Address the Issue
========================================================================

Start calling the methods on the projector but stub out the various
progress methods as noops.

Side Effects Caused By This Change
========================================================================

None expected.
  • Loading branch information
jfelchner committed Mar 4, 2023
1 parent a568206 commit 611b997
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ruby-progressbar/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def reset
output.with_refresh do
self.finished = false
progressable.reset
projector.reset
timer.reset
end
end
Expand Down Expand Up @@ -221,6 +222,7 @@ def format=(other)
def update_progress(*args)
output.with_refresh do
progressable.__send__(*args)
projector.__send__(*args)
timer.stop if finished?
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/ruby-progressbar/calculators/smoothed_average.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ def start(_options = {})
self.projection = 0.0
end

def decrement; end
def increment; end
def progress=(_new_progress); end
def total=(_new_total); end
def reset; end

def calculate(new_value)
self.projection = \
self.class.calculate(
Expand Down

0 comments on commit 611b997

Please sign in to comment.