Method: IPAddress::IPv4#netmask=

Defined in:
lib/ipaddress/ipv4.rb

#netmask=(addr) ⇒ Object

Like IPv4#prefix=, this method allow you to change the prefix / netmask of an IP address object.

ip = IPAddress("172.16.100.4")

puts ip
  #=> 172.16.100.4/16

ip.netmask = "255.255.252.0"

puts ip
  #=> 172.16.100.4/22


210
211
212
# File 'lib/ipaddress/ipv4.rb', line 210

def netmask=(addr)
  @prefix = Prefix32.parse_netmask(addr)
end