Class: Arachni::OptEnum

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

Overview

Enum option.

Instance Attribute Summary

Attributes inherited from OptBase

#default, #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

#descObject



252
253
254
255
256
257
# File 'lib/arachni/component_options.rb', line 252

def desc
    if self.enums
        str = self.enums.join(', ')
    end
    "#{self.desc_string || ''} (accepted: #{str})"
end

#desc=(value) ⇒ Object



246
247
248
249
250
# File 'lib/arachni/component_options.rb', line 246

def desc=(value)
    self.desc_string = value

    self.desc
end

#normalize(value = self.value) ⇒ Object



241
242
243
244
# File 'lib/arachni/component_options.rb', line 241

def normalize(value=self.value)
    return nil if not self.valid?(value)
    return value.to_s
end

#typeObject



231
232
233
# File 'lib/arachni/component_options.rb', line 231

def type
    return 'enum'
end

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

Returns:

  • (Boolean)


235
236
237
238
239
# File 'lib/arachni/component_options.rb', line 235

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

    (value and self.enums.include?(value.to_s))
end