Class: Arachni::Component::Options::String

Inherits:
Base show all
Defined in:
lib/arachni/component/options/string.rb

Overview

Mult-byte character string 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
34
35
36
37
# File 'lib/arachni/component/options/string.rb', line 27

def normalize( value )
    if value =~ /^file:(.*)/
        path = $1
        begin
            value = File.read( path )
        rescue ::Errno::ENOENT, ::Errno::EISDIR
            value = nil
        end
    end
    value
end

#typeObject



23
24
25
# File 'lib/arachni/component/options/string.rb', line 23

def type
    'string'
end

#valid?(value = self.value) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
42
43
# File 'lib/arachni/component/options/string.rb', line 39

def valid?( value = self.value )
    value = normalize( value )
    return false if empty_required_value?( value )
    super
end