Sha256: fd348ff8d522df01fdcb8112f7783c8436035bbbccc812876d60d6b47dfcbe68

Contents?: true

Size: 896 Bytes

Versions: 4

Compression:

Stored size: 896 Bytes

Contents

# Gathers all the association names to pass to `ActiveRecord::Relation#includes` from a
# `Metasploit::Model::Search::Query`
class MetasploitDataModels::Search::Visitor::Includes
  include Metasploit::Model::Visitation::Visit

  #
  # Visitors
  #

  visit 'Metasploit::Model::Search::Group::Base',
        'Metasploit::Model::Search::Operation::Group::Base' do |parent|
    parent.children.flat_map { |child|
      visit child
    }
	end

  visit 'Metasploit::Model::Search::Operation::Base' do |operation|
    visit operation.operator
  end

  visit 'Metasploit::Model::Search::Operator::Association' do |operator|
    [operator.association]
  end

  visit 'Metasploit::Model::Search::Operator::Attribute',
        'MetasploitDataModels::Search::Operator::IPAddress',
        'MetasploitDataModels::Search::Operator::Port::List' do |_operator|
    []
  end

  Metasploit::Concern.run(self)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metasploit_data_models-0.19.3-java app/models/metasploit_data_models/search/visitor/includes.rb
metasploit_data_models-0.19.3 app/models/metasploit_data_models/search/visitor/includes.rb
metasploit_data_models-0.19.0 app/models/metasploit_data_models/search/visitor/includes.rb
metasploit_data_models-0.19.0-java app/models/metasploit_data_models/search/visitor/includes.rb