summaryrefslogtreecommitdiff
path: root/lib/slop/types.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/slop/types.rb')
-rw-r--r--lib/slop/types.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/slop/types.rb b/lib/slop/types.rb
index 07d7e62..c1055ea 100644
--- a/lib/slop/types.rb
+++ b/lib/slop/types.rb
@@ -52,8 +52,7 @@ module Slop
# Cast the option argument to a Float.
class FloatOption < Option
def call(value)
- # TODO: scientific notation, etc.
- value =~ /\A[+-]?\d*\.*\d+\z/ && value.to_f
+ value =~ /\A[+-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?\z/ && value.to_f
end
end