From 3946a7b8e45e27928e57ed9f85bac2ef2b927c0c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 29 Jul 2010 00:27:38 -0400 Subject: options, minor code shuffling --- lib/sisu/v2/options.rb | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/sisu/v2/options.rb b/lib/sisu/v2/options.rb index 77e56a47..fbf8336a 100644 --- a/lib/sisu/v2/options.rb +++ b/lib/sisu/v2/options.rb @@ -69,29 +69,33 @@ module SiSU_commandline a.each do |x| y=case x when /0/ - if x=~/^-1\S+/; x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') - else x.gsub(/^-0/,shortcut.cf_0 + ' ') - end + (x=~/^-1\S+/) \ + ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \ + : x.gsub(/^-0/,shortcut.cf_0 + ' ') when /1/ - if x=~/^-1\S+/; x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') - else x.gsub(/^-1/,shortcut.cf_1 + ' ') - end + (x=~/^-1\S+/) \ + ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \ + : x.gsub(/^-1/,shortcut.cf_1 + ' ') when /2/ - if x=~/^-2\S+/; x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') - else x.gsub(/^-2/,shortcut.cf_2 + ' ') - end + (x=~/^-2\S+/) \ + ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \ + : x.gsub(/^-2/,shortcut.cf_2 + ' ') when /3/ - if x=~/^-3\S+/; x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') - else x.gsub(/^-3/,shortcut.cf_3 + ' ') - end + (x=~/^-3\S+/) \ + ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \ + : x.gsub(/^-3/,shortcut.cf_3 + ' ') when /4/ - if x=~/^-4\S+/; x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') - else x.gsub(/^-4/,shortcut.cf_4 + ' ') - end + (x=~/^-4\S+/) \ + ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \ + : x.gsub(/^-4/,shortcut.cf_4 + ' ') when /5/ - if x=~/^-5\S+/; x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') - else x.gsub(/^-5/,shortcut.cf_5 + ' ') - end + (x=~/^-5\S+/) \ + ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \ + : x.gsub(/^-5/,shortcut.cf_5 + ' ') + when /6/ + (x=~/^-6\S+/) \ + ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \ + : x.gsub(/^-6/,shortcut.cf_5 + ' ') else x end s << " #{y}" unless y.empty? -- cgit v1.2.3