L
Luke Galea
Hi all,
curious if there is a nice ruby way to express an xpath like navigation of an
object graph..
ie:
XPATH way:
Countries/Provinces/Cities[ @name = "London" ]
versus
The only Ruby way I can think of:
countries.collect{ |c| c.provinces.collect {|p| p.cities.select { |c2| c2#name
== 'London' } } }
Thanks in advance
curious if there is a nice ruby way to express an xpath like navigation of an
object graph..
ie:
XPATH way:
Countries/Provinces/Cities[ @name = "London" ]
versus
The only Ruby way I can think of:
countries.collect{ |c| c.provinces.collect {|p| p.cities.select { |c2| c2#name
== 'London' } } }
Thanks in advance