commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
822 stars 74 forks source link

Small optimisation of remove_global_options #91

Closed orien closed 4 years ago

orien commented 4 years ago

I notice there's no need to mutate the switches array.

https://github.com/commander-rb/commander/blob/0abbac486ea7d87f6f680aaf17d0e3cd136dbf73/lib/commander/runner.rb#L336

As only first portion of each switch is compared to the argument.

https://github.com/commander-rb/commander/blob/0abbac486ea7d87f6f680aaf17d0e3cd136dbf73/lib/commander/runner.rb#L344

I propose to remove this mutation.