Class: Arachni::OptString

Inherits:
OptBase show all
Defined in:
lib/arachni/component_options.rb

Overview

Mult-byte character string 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



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/arachni/component_options.rb', line 162

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



158
159
160
# File 'lib/arachni/component_options.rb', line 158

def type
    return 'string'
end

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

Returns:

  • (Boolean)


174
175
176
177
178
# File 'lib/arachni/component_options.rb', line 174

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