Class: Arachni::OptFloat
- Defined in:
- lib/arachni/component_options.rb
Overview
Floating point option.
Instance Attribute Summary
Attributes inherited from OptBase
#default, #desc, #enums, #name, #owner, #required
Instance Method Summary collapse
Methods inherited from OptBase
#empty_required_value?, #initialize, #required?, #to_h, #type?
Constructor Details
This class inherits a constructor from Arachni::OptBase
Instance Method Details
#normalize(value) ⇒ Object
404 405 406 407 408 409 410 |
# File 'lib/arachni/component_options.rb', line 404 def normalize(value) begin Float( value ) rescue nil end end |
#type ⇒ Object
400 401 402 |
# File 'lib/arachni/component_options.rb', line 400 def type return 'float' end |
#valid?(value) ⇒ Boolean
412 413 414 415 416 417 418 419 420 |
# File 'lib/arachni/component_options.rb', line 412 def valid?(value) return false if empty_required_value?(value) if value and not normalize(value).to_s.match(/^\d+\.\d+$/) return false end return super end |