Skip to content

Proposal to add subnet information to the to_string method. #54

@krpk1900

Description

@krpk1900

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions