Class: Feroxbuster::Command::TimeSpec Private

Inherits:
CommandMapper::Types::Str
  • Object
show all
Defined in:
lib/feroxbuster/command.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents the type for the --time-limit option.

Instance Method Summary collapse

Instance Method Details

#validate(value) ⇒ true, (false, String)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validates the given value.

Parameters:

  • value (Object)

    The given value to validate.

Returns:

  • (true, (false, String))

    Returns true if the value is considered valid, or false and a validation message if the value is not valid.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/feroxbuster/command.rb', line 23

def validate(value)
  valid, message = super(value)

  unless valid
    return [valid, message]
  end

  value = value.to_s

  unless value =~ /\A\d+(?:m|s|ms|ns)\z/
    return [false, "must be a number and end with 'm', 's', 'ms', or 'ns'"]
  end

  return true
end