Rails - Delete An Item From Array

As a programmer who works with Ruby On Rails, I often find a case which requires array manipulation. One of them needs me to delete an item from an array. Fortunately, all items in that array is string type. After reading Ruby On Rails documentation, I find an easy way to remove or delete an item in array based on given condition. This is how to do it.

Of course we need to make a loop and check every item in an array. Then give it condition : if an item is matched with that condition, we delete it. That's the simple logic. Luckily, Ruby On Rails gives simpler syntax to do that simple logic. Here it is.

arr = Array.new
arr.push('a','b','c')
arr.delete_if {|item| item== 'b' } 

#result is ['a','c']