From: "Ara.T.Howard" Date: 2005-08-21T02:12:33+09:00 Subject: Re: object pattern matching On Sun, 21 Aug 2005, James Britt wrote: > Ara.T.Howard wrote: >> >> i've been toying with an idea lately and thinking about how one would crawl >> an >> object graph to determine if it matched a specifc object. for instance >> >> >> array_of_hashes = [ {}, {} ] >> >> specific_array_of_hashes = [ {'key' => 'value}, {:k => :v} ] >> specific_array_of_hashes_2 = [ {:k => :v} ] >> >> specific_array_of_hashes.is_shaped_like? array_of_hashes #=> true >> >> so, something like pattern matching in ml languages. any concepts on how >> to >> do that in ruby for arbitrary objects? >> > > Isn't there a Ruby project that allows one to run regexen over object > hierarchies? dunno... i seem to recall something too but searching the raa didn't bring up any hits? cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================