Skip to content

Commit

Permalink
refactoring: sortDecorators to populateEwmaDecorators
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Aug 17, 2024
1 parent 655922b commit c0a9ceb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions bar.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,9 @@ func (s *bState) wSyncTable() (table syncTable) {
return table
}

func (s *bState) sortDecorators(decorators []decor.Decorator) {
func (s *bState) populateEwmaDecorators(decorators []decor.Decorator) {
for _, d := range decorators {
d := unwrap(d)
if d, ok := d.(decor.EwmaDecorator); ok {
if d, ok := unwrap(d).(decor.EwmaDecorator); ok {
s.ewmaDecorators = append(s.ewmaDecorators, d)
}
}
Expand Down
4 changes: 2 additions & 2 deletions bar_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func inspect(decorators []decor.Decorator) (dest []decor.Decorator) {
func PrependDecorators(decorators ...decor.Decorator) BarOption {
decorators = inspect(decorators)
return func(s *bState) {
s.sortDecorators(decorators)
s.populateEwmaDecorators(decorators)
s.decorators[0] = decorators
}
}
Expand All @@ -33,7 +33,7 @@ func PrependDecorators(decorators ...decor.Decorator) BarOption {
func AppendDecorators(decorators ...decor.Decorator) BarOption {
decorators = inspect(decorators)
return func(s *bState) {
s.sortDecorators(decorators)
s.populateEwmaDecorators(decorators)
s.decorators[1] = decorators
}
}
Expand Down

0 comments on commit c0a9ceb

Please sign in to comment.