Class: Optimist::FloatOption

Inherits:
Option
  • Object
show all
Defined in:
lib/firebase-ruby/optimist.rb

Overview

Floating point number option class.

Direct Known Subclasses

FloatArrayOption

Instance Attribute Summary

Attributes inherited from Option

#default, #long, #multi_given, #name, #short

Instance Method Summary collapse

Methods inherited from Option

#array_default?, #callback, create, #desc, #description_with_default, #educate, #flag?, #initialize, #multi, #multi_arg?, #opts, #opts=, register_alias, #required?, #short?, #single_arg?

Constructor Details

This class inherits a constructor from Optimist::Option

Instance Method Details

#parse(paramlist, _neg_given) ⇒ Object



768
769
770
771
772
773
774
775
# File 'lib/firebase-ruby/optimist.rb', line 768

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



767
# File 'lib/firebase-ruby/optimist.rb', line 767

def type_format ; "=<f>" ; end