Class: Slop::FloatOption
Overview
Cast the option argument to a Float.
Constant Summary
Constants inherited from Option
Instance Attribute Summary
Attributes inherited from Option
#block, #config, #count, #desc, #flags, #value
Instance Method Summary collapse
Methods inherited from Option
#default_value, #ensure_call, #expects_argument?, #finish, #flag, #help?, #initialize, #key, #null?, #required?, #reset, #suppress_errors?, #tail, #tail?, #to_s, #underscore_flags?
Constructor Details
This class inherits a constructor from Slop::Option
Instance Method Details
#call(value) ⇒ Object
54 55 56 57 |
# File 'lib/slop/types.rb', line 54 def call(value) # TODO: scientific notation, etc. value =~ /\A-?\d*\.*\d+\z/ && value.to_f end |