From: jm Date: 2004-05-10T10:04:20+09:00 Subject: Re: ruby replacement for net::patricia needed This combined with the suggestion made by hgs@dmu.ac.uk to use truplespaces may provide a short term solution. The only problem I have with truplespaces is the number of match operations that may be needed. I checked the authors web pages (which is in japanese) from reading between the lines I don't think he mentions what algorithm he uses. Looks like I'll have to read the source. Take a look at some of the following for info on patricia tries if your curious, http://en.wikipedia.org/wiki/Patricia_trie http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Tree/PATRICIA/ "Optimized IP to ISO3166 Country Code Mapping in C#" which uses tries http://www.codeproject.com/csharp/iptocountry.asp This paper discusses various algorithms (it contains some typos) http://herodes.redes.upv.es/rap/Routers%20Altas%20Prestaciones/ ip_report.pdf Citation info for original paper, http://theory.lcs.mit.edu/~jacm/Authors/morrisondonaldr.html Jeff. On 07/05/2004, at 9:45 PM, YANAGAWA Kazuhisa wrote: > In Message-Id: > jm writes: > >> p = Patricia.new() >> p.add_address('127.0.0.0/8', obj) # stores object obj >> o = p.match('127.0.0.1') # returns object obj >> >> Is there anything similar already in existence for ruby? Is it >> possible to adapt the acl modules? > > I don't know whether patricia trie itself is essential or not, but > ipaddr.rb, bundled with the current Ruby distribution, may help you. > > require "ipaddr" > > net = IPAddr.new("127.0.0.0/8") > net.include?(IPAddr.new("127.0.0.1")) #=> true > > > -- > kjana@dm4lab.to May 7, 2004 > A man is known by the company he keeps. > >