Ball, Donald A Jr (Library)
5/9/2007 6:18:00 PM
> -----Original Message-----
> From: anansi [mailto:kazaam@oleco.net]
> Sent: Wednesday, May 09, 2007 12:15 PM
> To: ruby-talk ML
> Subject: wildcard arrays or lists
>
> hi ,
> I wondered if it is possible to tell ruby to accept wildcards
> in arrays or lists. I have a function which relys on .each
> and accepts arrays and lists of IP's. Is it possible to use
> wildcards in an array like
>
> buff = Array(127.0.*.*)
There's a nice ipaddr library in the stdlib which models ip networks and
addresses, you might want to look at it:
network = IPAddr.new('192.168.0.0/16')
network.include?(IPAddr.new('192.168.0.1'))
- donald