diff options
author | Juha Ylitalo <juha.ylitalo@reaktor.fi> | 2019-08-23 15:50:40 +0300 |
---|---|---|
committer | Juha Ylitalo <juha.ylitalo@reaktor.fi> | 2019-08-23 15:50:40 +0300 |
commit | 8af498a401819b62dd635cca11d315e59f782ad4 (patch) | |
tree | 823f5668e40eaf0d4f49364c21324a3ce9e5f3bd /lib | |
parent | 4e60891d9bed6d08b8ab46634b0239f11f2ca4bf (diff) | |
download | slop-8af498a401819b62dd635cca11d315e59f782ad4.tar.gz |
Support '+' as prefix for integer
Diffstat (limited to 'lib')
-rw-r--r-- | lib/slop/types.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/slop/types.rb b/lib/slop/types.rb index b7e41c8..4cd6136 100644 --- a/lib/slop/types.rb +++ b/lib/slop/types.rb @@ -44,7 +44,7 @@ module Slop # Cast the option argument to an Integer. class IntegerOption < Option def call(value) - value =~ /\A-?\d+\z/ && value.to_i + value =~ /\A[+-]?\d+\z/ && value.to_i end end IntOption = IntegerOption |