Class: Trollop::FloatOption
Overview
Floating point number option class.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Option
#default, #long, #multi_given, #name, #permitted, #short
Instance Method Summary collapse
Methods inherited from Option
#array_default?, #callback, create, #desc, #description_with_default, #description_with_permitted, #educate, #flag?, #full_description, #initialize, #multi, #multi_arg?, #opts, #opts=, register_alias, #required?, #short?, #single_arg?
Constructor Details
This class inherits a constructor from Trollop::Option
Instance Method Details
#parse(paramlist, _neg_given) ⇒ Object
804 805 806 807 808 809 810 811 |
# File 'lib/rbcli/util/trollop.rb', line 804 def parse(paramlist, _neg_given) paramlist.map do |pg| pg.map do |param| raise CommandlineError, "option '#{self.name}' needs a floating-point number" unless param.is_a?(Numeric) || param =~ FLOAT_RE param.to_f end end end |
#type_format ⇒ Object
803 |
# File 'lib/rbcli/util/trollop.rb', line 803 def type_format ; "=<f>" ; end |