From: "Ball, Donald A Jr (Library)" Date: 2007-05-10T03:17:31+09:00 Subject: Re: wildcard arrays or lists > -----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