From 8af498a401819b62dd635cca11d315e59f782ad4 Mon Sep 17 00:00:00 2001 From: Juha Ylitalo Date: Fri, 23 Aug 2019 15:50:40 +0300 Subject: Support '+' as prefix for integer --- lib/slop/types.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.1