R
Raphael Bauduin
Hi,
applying the example found in "ri Array#delete_if":
irb(main):020:0> a = [ "a", "b", "c" ]
=> ["a", "b", "c"]
irb(main):021:0> a.delete_if {|x| x >= "b" }
=> ["a"]
irb(main):022:0> a
=> ["a"]
How do I get the elements that where rejected? (Btw, shouldn't this
method end in a "!" ?)
As illustration, I'm looking for a way similar to the pure fictional
method below:
a = [ "a", "b", "c" ]
a.keep_if {|x| x >= "b" }
=> [ "b", "c" ]
Thanks
Raph
applying the example found in "ri Array#delete_if":
irb(main):020:0> a = [ "a", "b", "c" ]
=> ["a", "b", "c"]
irb(main):021:0> a.delete_if {|x| x >= "b" }
=> ["a"]
irb(main):022:0> a
=> ["a"]
How do I get the elements that where rejected? (Btw, shouldn't this
method end in a "!" ?)
As illustration, I'm looking for a way similar to the pure fictional
method below:
a = [ "a", "b", "c" ]
a.keep_if {|x| x >= "b" }
=> [ "b", "c" ]
Thanks
Raph