From: James Britt Date: 2005-08-21T01:50:07+09:00 Subject: Re: object pattern matching 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? James -- http://www.ruby-doc.org - The Ruby Documentation Site http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys