Proposal to add subnet information to the to_string method.
krpk1900 opened this issue · comments
Terai Shogo commented
Thank you for the great gem.
The inspect
method contains subnet information and it seemed more natural to the developer that the to_string
method should also contain the same subnet information.
So how about adding subnet information to the to_string
method?
【Now】
ipaddr = IPAddr.new("192.168.2.0/24")
ipaddr.inspect
=> "#<IPAddr: IPv4:192.168.2.0/255.255.255.0>"
ipaddr.to_s
=> "192.168.2.0"
ipaddr.to_string
=> "192.168.2.0"
【My Proposal】
ipaddr = IPAddr.new("192.168.2.0/24")
ipaddr.inspect
=> "#<IPAddr: IPv4:192.168.2.0/255.255.255.0>"
ipaddr.to_s
=> "192.168.2.0"
ipaddr.to_string
=> "192.168.2.0/24"
Kasumi Hanazuki commented
Related proposal:
Terai Shogo commented
Thank you.👍