diff options
author | Lee Jarvis <ljjarvis@gmail.com> | 2013-06-16 17:51:09 +0100 |
---|---|---|
committer | Lee Jarvis <ljjarvis@gmail.com> | 2013-06-17 10:11:05 +0100 |
commit | 8c4caa9d5e6fa799087528b60e1acaf37c72de63 (patch) | |
tree | 888cff5e8d10e7f7ef773fd5d6e037219643b950 /lib/slop.rb | |
parent | 2d2634992f47ddb56a95f7b3de48effc27585937 (diff) | |
download | slop-8c4caa9d5e6fa799087528b60e1acaf37c72de63.tar.gz |
clean up some logic in build_option
Diffstat (limited to 'lib/slop.rb')
-rw-r--r-- | lib/slop.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/slop.rb b/lib/slop.rb index eb41e2a..1ecb7e7 100644 --- a/lib/slop.rb +++ b/lib/slop.rb @@ -627,12 +627,12 @@ class Slop config[:optional_argument] = true if @config[:optional_arguments] if objects.last.is_a?(Hash) - config.merge!(objects.last) - objects.pop + config.merge!(objects.pop) end + short = extract_short_flag(objects, config) long = extract_long_flag(objects, config) - desc = objects[0].respond_to?(:to_str) ? objects.shift : nil + desc = objects.shift if objects[0].respond_to?(:to_str) Option.new(self, short, long, desc, config, &block) end |