moss

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f949623298a1a2fc6552404fc747f926ea0dbdea
parent 8797e02a2ca6f7ed04d9e96953187207bfbd6b7f
Author: Daniel Barlow <dan@telent.net>
Date:   Thu, 12 Aug 2021 22:05:01 +0100

remove unneeded assignments in regex matching

Diffstat:
Mspec/cli_spec.rb | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb @@ -18,13 +18,9 @@ class CLI1 return [ name, [] ] if arg_signature.empty? flags = argv.reduce({}) {|m, flag| - matchdata = flag.match(/\A--(\w+)(?:=(.+))?/) - if matchdata - key, val = matchdata.captures - key ? - m.merge(key.to_sym => val ? val : :key_present) : - m - else + key, val= flag.match(/\A--(\w+)(?:=(.+))?/)&.captures + key ? + m.merge(key.to_sym => val ? val : :key_present) : m end }