Class: OptimistXL::FloatOption

Inherits:
Option
  • Object
show all
Defined in:
lib/optimist_xl.rb

Overview

Floating point number option class.

Direct Known Subclasses

FloatArrayOption

Instance Attribute Summary

Attributes inherited from Option

#default, #long, #max_args, #min_args, #multi_given, #name, #permitted, #permitted_response, #short

Instance Method Summary collapse

Methods inherited from Option

#array_default?, #callback, #compatible_with?, create, #desc, #description_with_default, #description_with_permitted, #doesnt_need_autogen_short, #educate, #format_stdio, #full_description, handle_long_opt, handle_short_opt, #initialize, #multi, #opts, #opts=, #permitted_type_valid?, #permitted_valid_string, #permitted_value?, register_alias, #required?, #validate_permitted

Constructor Details

This class inherits a constructor from OptimistXL::Option

Instance Method Details

#parse(paramlist, _neg_given) ⇒ Object



1150
1151
1152
1153
1154
1155
1156
1157
# File 'lib/optimist_xl.rb', line 1150

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_formatObject



1149
# File 'lib/optimist_xl.rb', line 1149

def type_format ; "=<f>" ; end