Class: Arachni::Component::Options::Float
- Defined in:
- lib/arachni/component/options/float.rb
Overview
Floating point option.
Instance Attribute Summary
Attributes inherited from Base
#default, #desc, #enums, #name
Instance Method Summary collapse
Methods inherited from Base
#==, #empty_required_value?, #initialize, #required?, #to_h, #type?
Constructor Details
This class inherits a constructor from Arachni::Component::Options::Base
Instance Method Details
#normalize(value) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/arachni/component/options/float.rb', line 27 def normalize( value ) begin Float( value ) rescue nil end end |
#type ⇒ Object
23 24 25 |
# File 'lib/arachni/component/options/float.rb', line 23 def type 'float' end |
#valid?(value) ⇒ Boolean
35 36 37 38 39 40 41 42 43 |
# File 'lib/arachni/component/options/float.rb', line 35 def valid?( value ) return false if empty_required_value?( value ) if value && !normalize( value ).to_s.match( /^\d+\.\d+$/ ) return false end super end |