J
Jonas Schneider
Heya,
I'm pretty sure theres an easy way for this:
I have a collection of objects; I want to remove 1 property (they all
have it in common) from them.
so if
a = [
{:a => 'blah', rop => '123'},
{:a => 'blab', rop => '234'}
]
I want to remove the attribute "prop" from all of them.
I tried it with this the first time:
a.collect {|x| y = x.to_a; y.delete(x.prop); y }
but it doesnt seem to work; i the property isn't removed, and it would
also be bad if some other property would have the same value cause it
would get removed, too.
I´m sure there's some a.without method or something, but I'm not able
to find it...
Help?
Greets
Jonas
I'm pretty sure theres an easy way for this:
I have a collection of objects; I want to remove 1 property (they all
have it in common) from them.
so if
a = [
{:a => 'blah', rop => '123'},
{:a => 'blab', rop => '234'}
]
I want to remove the attribute "prop" from all of them.
I tried it with this the first time:
a.collect {|x| y = x.to_a; y.delete(x.prop); y }
but it doesnt seem to work; i the property isn't removed, and it would
also be bad if some other property would have the same value cause it
would get removed, too.
I´m sure there's some a.without method or something, but I'm not able
to find it...
Help?
Greets
Jonas