Skip to content

Commit e6b09ad

Browse files
committed
Refactor: The Projector Can Now Start Itself
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.
1 parent 0c956e6 commit e6b09ad

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/ruby-progressbar/progress.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def initialize(options = {})
1919
end
2020

2121
def start(options = {})
22-
running_average_calculator.start
2322
self.progress = \
2423
self.starting_position = options[:at] || progress
2524
end

spec/lib/ruby-progressbar/progress_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class ProgressBar
124124
progress = Progress.new(:total => 50, :projector => projector)
125125

126126
projector.__send__(:projection=, 10)
127+
projector.start
127128
progress.start :at => 0
128129

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

140141
projector.__send__(:projection=, 10)
142+
projector.start
141143
progress.start :at => 0
142144

143145
expect(progress.running_average).to be_zero

0 commit comments

Comments
 (0)