Class: Metasploit::Model::Search::Operator::Delegation

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

Overview

An operator that delegates to another operator(s).

Instance Attribute Summary

Attributes inherited from Base

#klass

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Help

#help

Methods inherited from Base

#initialize, #valid!

Constructor Details

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

Class Method Details

.operator_nameString

Note:

Can't be called name because it would alias Class#name.

Name of this operator.

Returns:

  • (String)

12
13
14
# File 'app/models/metasploit/model/search/operator/delegation.rb', line 12

def self.operator_name
  @operator_name ||= name.demodulize.underscore.to_sym
end

Instance Method Details

#nameString

Name of operator.

Returns:

  • (String)

19
20
21
# File 'app/models/metasploit/model/search/operator/delegation.rb', line 19

def name
  @name ||= self.class.operator_name
end

#operator(formatted_operator) ⇒ Metasploit::Model::Search::Operator::Base (protected)

Finds operator with the given name on Base#klass.

Parameters:

  • formatted_operator (#to_sym)

    Name of operator.

Returns:


30
31
32
33
34
35
36
37
38
39
# File 'app/models/metasploit/model/search/operator/delegation.rb', line 30

def operator(formatted_operator)
  name = formatted_operator.to_sym
  operator = klass.search_operator_by_name[name]

  unless operator
    raise ArgumentError, "No operator with name #{name.inspect} on #{klass}"
  end

  operator
end