Module: MetasploitDataModels::Match::Parent

Extended by:
ActiveSupport::Concern
Included in:
IPAddress::V4::Segment::Nmap::List, Search::Operation::IPAddress
Defined in:
lib/metasploit_data_models/match/parent.rb

Overview

Uses classes that extend Child

Examples:

Add match_child to class.

class Parent
  include MetasploitDataModels::Match::Parent

  match_children_named %w{FirstChild SecondChild}
end

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#match_child(formatted_value) ⇒ Object?

Parameters:

  • formatted_value (#to_s)

    A formatted value for the child's #value.

Returns:



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/metasploit_data_models/match/parent.rb', line 90

def match_child(formatted_value)
  child = nil

  self.class.match_children.each do |child_class|
    child = child_class.match(formatted_value)

    if child
      break
    end
  end

  child
end