#--
# Daniel Schierbeck
#++

class Array

  def delete_unless (&block)
    delete_if { |element| not block.call(element) }
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TC_DELETE_UNLESS < Test::Unit::TestCase

    def test_delete_unless
      a = [1,2,3]
      a.delete_unless{ |e| e == 2 }
      assert_equal( [2], a )
    end

  end

=end
