Module: MetasploitDataModels::IPAddress::Range

Extended by:
ActiveModel::Naming, ActiveSupport::Concern
Included in:
V4::Range, V4::Segment::Nmap::Range
Defined in:
lib/metasploit_data_models/ip_address/range.rb

Overview

Common behavior for ranges under MetasploitDataModels::IPAddress, including ranges of addresses and segments.

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

SEPARATOR =

Separator between the #begin and #end in the formatted value.

'-'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject

Returns the value of attribute value.



24
25
26
# File 'lib/metasploit_data_models/ip_address/range.rb', line 24

def value
  @value
end

Instance Method Details

#beginMetasploitDataModels::IPAddress::V4::NMAP::Segment::Number?

Begin of segment range.

Returns:

  • (MetasploitDataModels::IPAddress::V4::NMAP::Segment::Number)

    if #value is a Range.

  • (nil)

    if #value is not a Range.



116
117
118
119
120
# File 'lib/metasploit_data_models/ip_address/range.rb', line 116

def begin
  if value.respond_to? :begin
    value.begin
  end
end

#endMetasploitDataModels::IPAddress::V4::NMAP::Segment::Number?

End of segment range.

Returns:

  • (MetasploitDataModels::IPAddress::V4::NMAP::Segment::Number)

    if #value is a Range.

  • (nil)

    if #value is not a Range.



126
127
128
129
130
# File 'lib/metasploit_data_models/ip_address/range.rb', line 126

def end
  if value.respond_to? :end
    value.end
  end
end

#to_sString

This range as a string. Equivalent to the original formatted_value passed to #value.

Returns:

  • (String)


135
136
137
# File 'lib/metasploit_data_models/ip_address/range.rb', line 135

def to_s
  "#{self.begin}#{SEPARATOR}#{self.end}"
end