lib/args_parser/parser.rb in args_parser-0.0.9 vs lib/args_parser/parser.rb in args_parser-0.0.10
- old
+ new
@@ -35,13 +35,13 @@
@aliases = {}
@filter = Filter.new
@validator = Validator.new
filter do |v|
- (v.kind_of? String and v =~ /^\d+$/) ? v.to_i : v
+ (v.kind_of? String and v =~ /^-?\d+$/) ? v.to_i : v
end
filter do |v|
- (v.kind_of? String and v =~ /^\d+\.\d+$/) ? v.to_f : v
+ (v.kind_of? String and v =~ /^-?\d+\.\d+$/) ? v.to_f : v
end
on_filter_error do |err, name, value|
raise err
end
on_validate_error do |err, name, value|