class Optimist::FloatOption

Floating point number option class.

Public Instance Methods

as_type(param) click to toggle source
# File lib/optimist.rb, line 1012
def as_type(param) ; param.to_f ; end
parse(paramlist, _neg_given) click to toggle source
# File lib/optimist.rb, line 1013
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
      as_type(param)
    end
  end
end
type_format() click to toggle source
# File lib/optimist.rb, line 1011
def type_format ; "=<f>" ; end