summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Ylitalo <juha.ylitalo@reaktor.fi>2019-08-23 15:50:40 +0300
committerJuha Ylitalo <juha.ylitalo@reaktor.fi>2019-08-23 15:50:40 +0300
commit8af498a401819b62dd635cca11d315e59f782ad4 (patch)
tree823f5668e40eaf0d4f49364c21324a3ce9e5f3bd
parent4e60891d9bed6d08b8ab46634b0239f11f2ca4bf (diff)
downloadslop-8af498a401819b62dd635cca11d315e59f782ad4.tar.gz
Support '+' as prefix for integer
-rw-r--r--lib/slop/types.rb2
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