Class: Metasploit::Model::Search::Operation::Boolean

Inherits:
Base
  • Object
show all
Defined in:
app/models/metasploit/model/search/operation/boolean.rb

Overview

Search operation with Metasploit::Model::Search::Operation::Base#operator with #type :boolean. Validates that value is a proper boolean (false or true) or the String version of either.

Constant Summary collapse

FORMATTED_VALUE_TO_VALUE =

Take a String formatted Metasploit::Model::Search::Operation::Base#value and returns its unformatted value for validation.

{
    'false' => false,
    'true' => true
}

Instance Attribute Summary

Attributes inherited from Base

#operator, #value

Instance Method Summary collapse

Methods inherited from Base

#operator_valid

Methods inherited from Base

#initialize, #valid!

Constructor Details

This class inherits a constructor from Metasploit::Model::Base

Instance Method Details

#value=(formatted_value) ⇒ false, ...

Sets Metasploit::Model::Search::Operation::Base#value by type casting String boolean to actual false or true.

Parameters:

  • formatted_value (Object)

Returns:

  • (false)

    if formatted_value is 'false'.

  • (true)

    if formatted_value is 'true'.

  • (Object)

    formatted_value otherwise.



33
34
35
# File 'app/models/metasploit/model/search/operation/boolean.rb', line 33

def value=(formatted_value)
  @value = FORMATTED_VALUE_TO_VALUE.fetch(formatted_value, formatted_value)
end