Skip to content

Commit

Permalink
Refactor: The Projector Can Now Start Itself
Browse files Browse the repository at this point in the history
Why This Change Is Necessary
========================================================================

Progress events are now being called properly on the projector and
therefore `Progress` no longer needs to do it.

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

Stop calling projector start when progress starts.

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

None expected.
  • Loading branch information
jfelchner committed Mar 4, 2023
1 parent 0c956e6 commit e6b09ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/ruby-progressbar/progress.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def initialize(options = {})
end

def start(options = {})
running_average_calculator.start
self.progress = \
self.starting_position = options[:at] || progress
end
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/ruby-progressbar/progress_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ProgressBar
progress = Progress.new(:total => 50, :projector => projector)

projector.__send__(:projection=, 10)
projector.start
progress.start :at => 0

expect(progress.running_average).to be_zero
Expand All @@ -138,6 +139,7 @@ class ProgressBar
progress = Progress.new(:total => 50, :projector => projector)

projector.__send__(:projection=, 10)
projector.start
progress.start :at => 0

expect(progress.running_average).to be_zero
Expand Down

0 comments on commit e6b09ad

Please sign in to comment.