7stud2
(7stud --)
1
Suppose a class:
class C_L_A_S_S
attr_accessor :a, :b, :c
end
I have an array of object of class above.
say a_of_obj
Now I want to delete the element from a_of_obj whose a=33
Could you please tell me the best way to do it?
···
--
Posted via http://www.ruby-forum.com/.
11129
(Иван Бишевац)
3
because it's extremely useful
···
2012/10/2 ajay paswan <lists@ruby-forum.com>
Suppose a class:
class C_L_A_S_S
attr_accessor :a, :b, :c
end
I have an array of object of class above.
say a_of_obj
Now I want to delete the element from a_of_obj whose a=33
Could you please tell me the best way to do it?
--
Posted via http://www.ruby-forum.com/\.
Look for Array in http://ruby-doc.org/core-1.9.3/\. Bookmark this page
7stud2
(7stud --)
4
a_of_obj.delete_if {|obj| obj.a == 33}
···
--
Posted via http://www.ruby-forum.com/.
7stud2
(7stud --)
5
Sam Duncan wrote in post #1078258:
Could you please tell me the best way to do it?
Is this homework?
No I am just playing around wit ruby, and sorry there is a delete
function for exactly the same purpose.
···
On 10/02/2012 11:06 AM, ajay paswan wrote:
Sam
--
Posted via http://www.ruby-forum.com/\.