Module: MetasploitDataModels::Match::Child
- Included in:
- IPAddress::CIDR::ClassMethods, IPAddress::V4::Range, IPAddress::V4::Segment::Nmap::Range, IPAddress::V4::Segment::Single, IPAddress::V4::Segmented
- Defined in:
- lib/metasploit_data_models/match/child.rb
Overview
no_instance = MetasploitDataModels::Format.match('12')
Instance Method Summary collapse
-
#match(formatted_value) ⇒ Object
Creates a new instance of the extending class if
MATCH_REGEXP, defined on the extending class, matchesformatted_value. -
#match_regexp ⇒ Regexp
Regular expression to match against for #match.
-
#regexp ⇒ Regexp
Regular expression to match child as part of Parent.
Instance Method Details
#match(formatted_value) ⇒ Object
Creates a new instance of the extending class if MATCH_REGEXP, defined on the extending class, matches
formatted_value.
26 27 28 29 30 31 32 33 34 |
# File 'lib/metasploit_data_models/match/child.rb', line 26 def match(formatted_value) instance = nil if match_regexp.match(formatted_value) instance = new(value: formatted_value) end instance end |
#match_regexp ⇒ Regexp
Regular expression to match against for #match.
39 40 41 |
# File 'lib/metasploit_data_models/match/child.rb', line 39 def match_regexp @match_regexp ||= /\A#{regexp}\z/ end |
#regexp ⇒ Regexp
Regular expression to match child as part of Parent.
46 47 48 |
# File 'lib/metasploit_data_models/match/child.rb', line 46 def regexp self::REGEXP end |