Class: Arachni::OptInt
Overview
Integer 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
375 376 377 378 379 380 381 |
# File 'lib/component_options.rb', line 375 def normalize(value) if (value.to_s.match(/^0x[a-fA-F\d]+$/)) value.to_i(16) else value.to_i end end |
#type ⇒ Object
371 372 373 |
# File 'lib/component_options.rb', line 371 def type return 'integer' end |
#valid?(value) ⇒ Boolean
383 384 385 386 387 388 389 390 391 |
# File 'lib/component_options.rb', line 383 def valid?(value) return false if empty_required_value?(value) if value and not normalize(value).to_s.match(/^\d+$/) return false end return super end |