range of ips

52 views
Skip to first unread message

Jay Perry

unread,
Jan 22, 2015, 9:22:55 AM1/22/15
to ruby-ip...@googlegroups.com
Was wondering if IPAddress supports either of these two scenarios?

1. Convert an integer to an ip address

I have an integer 167837953 how do I convert it to 10.1.1.1 using IPAddress?

2. If I have two ip addresses 172.1.1.1 and 172.1.1.10.  Is there a way to generate a list of ip addresses for this range?  Would like a result such as:

['172.1.1.1', '172.1.1.2', etc ]

Thanks,
Jay

Mike Mackintosh

unread,
Jan 26, 2015, 4:24:46 PM1/26/15
to ruby-ip...@googlegroups.com
Jay, 

I actually ran into the need with #1 to do the same thing. FYI, I created the following pull request for the maintainers to merge.


Thanks,

Mike
Reply all
Reply to author
Forward
0 new messages