Module: MetasploitDataModels::IPAddress::CIDR
- Extended by:
- ActiveModel::Naming, ActiveSupport::Concern
- Included in:
- V4::CIDR
- Defined in:
- lib/metasploit_data_models/ip_address/cidr.rb
Overview
Common behavior for Class-InterDomain Routing (<address>/<prefix-length>
) notation under
MetasploitDataModels::IPAddress,
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- SEPARATOR =
Separator between the #address and #prefix_length
'/'
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#prefix_length ⇒ Object
Returns the value of attribute prefix_length.
Instance Method Summary collapse
-
#prefix_length_before_type_cast ⇒ #to_s
The formatted_prefix_length passed to #prefix_length=.
-
#value=(formatted_value) ⇒ Object
Parses the
formatted_value
into an #address and #prefix_length.
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
23 24 25 |
# File 'lib/metasploit_data_models/ip_address/cidr.rb', line 23 def address @address end |
#prefix_length ⇒ Object
Returns the value of attribute prefix_length.
29 30 31 |
# File 'lib/metasploit_data_models/ip_address/cidr.rb', line 29 def prefix_length @prefix_length end |
Instance Method Details
#prefix_length_before_type_cast ⇒ #to_s
The formatted_prefix_length passed to #prefix_length=
148 149 150 |
# File 'lib/metasploit_data_models/ip_address/cidr.rb', line 148 def prefix_length_before_type_cast @prefix_length_before_type_cast end |
#value=(formatted_value) ⇒ Object
Parses the formatted_value
into an #address and #prefix_length.
155 156 157 158 159 160 161 162 |
# File 'lib/metasploit_data_models/ip_address/cidr.rb', line 155 def value=(formatted_value) formatted_address, formatted_prefix_length = formatted_value.to_s.split(SEPARATOR, 2) self.address = formatted_address self.prefix_length = formatted_prefix_length [address, prefix_length] end |