From: Luke Graham Date: 2005-04-11T12:50:06+09:00 Subject: groovy-like xml selection Hi list, Ive taken a quick look at groovy for the first time, and saw an interesting idea. Using xml to build an object tree, its possible to write code like this... foo.bar.star.select { |it| it[@age] == "1" && it.parent.name == "bar" && it.star.count == 0 } Note that foo.bar and foo.bar.star are not arrays, rather transparently hide multiple elements in one object. Requesting a value would be handled by the first element. The interesting part is that theres no quotes around the path expression, its just evaluated in the context of bar. Complex expressions could be broken into multiple selects and combined with normal array operations. Im sure someones done the xml->object (method in this case) thing, but has the native path trick been tried in ruby yet? PS. Extra kudos if someone implements not only the above, but foo.bar { ... }, where foo and bar are methods... -- spooq