File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 1
1
class Thor
2
2
class Arguments #:nodoc: # rubocop:disable ClassLength
3
- NUMERIC = /(\d *\. \d +|\d +)/
3
+ NUMERIC = /[-+]{0,1} (\d *\. \d +|\d +)/
4
4
5
5
# Receives an array of args and returns two arrays, one with arguments
6
6
# and one with switches.
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ def parse(*args)
21
21
create :string => nil , :numeric => nil
22
22
expect ( parse ( "name" , "13" ) [ "string" ] ) . to eq ( "name" )
23
23
expect ( parse ( "name" , "13" ) [ "numeric" ] ) . to eq ( 13 )
24
+ expect ( parse ( "name" , "+13" ) [ "numeric" ] ) . to eq ( 13 )
25
+ expect ( parse ( "name" , "+13.3" ) [ "numeric" ] ) . to eq ( 13.3 )
26
+ expect ( parse ( "name" , "-13" ) [ "numeric" ] ) . to eq ( -13 )
27
+ expect ( parse ( "name" , "-13.3" ) [ "numeric" ] ) . to eq ( -13.3 )
24
28
end
25
29
26
30
it "accepts hashes" do
You can’t perform that action at this time.
0 commit comments