Issue #11210 has been updated by Ben Miller.


It would be useful to expose @mask_addr. I have done this at times by reopening IPAddr and adding an attr_reader. Then the string form of the mask can be obtained with

```ruby
IPAddr.new(addr.mask_addr, addr.family).to_s
```

#mask_addr is also useful when doing subnetting operations which are beyond the scope of IPAddr.

----------------------------------------
Feature #11210: IPAddr has no public method to get the current subnet mask
https://bugs.ruby-lang.org/issues/11210#change-52718

* Author: Herwin .
* Status: Open
* Priority: Low
* Assignee: 
----------------------------------------
Both to_s and to_string omit the subnet mask of an IP address. The only way to query it via public methods is to manually parse the output of inspect. 



-- 
https://bugs.ruby-lang.org/