Class: Ragol::FloatOption

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

Direct Known Subclasses

Synoption::FloatOption

Constant Summary collapse

REGEXP =
Regexp.new '^ ([\-\+]?\d* (?:\.\d+)?) $ ', Regexp::EXTENDED

Instance Attribute Summary

Attributes inherited from Option

#default, #description, #matchers, #name, #negates, #regexps, #tags

Instance Method Summary collapse

Methods inherited from Option

#argument_missing, #do_match, #initialize, #match_next_value, #match_next_value_optional, #match_next_value_required, #match_rc?, #post_process, #resolve_value, #set_option_value, #set_value_for_tag, #set_value_negative, #set_value_regexp, #take_eq_value, #takes_value?, #to_doc, #to_matcher, #to_s

Constructor Details

This class inherits a constructor from Ragol::Option

Instance Method Details

#convert(md) ⇒ Object



14
15
16
17
# File 'lib/ragol/float_option.rb', line 14

def convert md
  return unless val = md && md[-1]
  val.to_f
end

#value_regexpObject



10
11
12
# File 'lib/ragol/float_option.rb', line 10

def value_regexp
  REGEXP
end