Method: NetAddr::Mask128.parse
- Defined in:
- lib/mask128.rb
.parse(mask) ⇒ Object
parse will create an Mask128 from its string representation. arguments:
-
mask - String representing an netmask (ie. “/64”).
Throws ValidationError on error.
28 29 30 31 32 33 34 |
# File 'lib/mask128.rb', line 28 def Mask128.parse(mask) mask.strip! if (mask.start_with?("/")) # cidr format mask = mask[1..-1] # remove "/" end return Mask128.new(mask.to_i) end |