Sha256: 1bd7c6a115745dd87296cb52392410e100ac1e7f5f2dec7e2be1262abb3d0cc2
Contents?: true
Size: 562 Bytes
Versions: 3
Compression:
Stored size: 562 Bytes
Contents
class Array # Delete multiple values from array. # # require 'facet/array/delete_values' # # a = [1,2,3,4] # a.delete_values(1,2) #=> [1,2] # a #=> [3,4] # def delete_values(*values) d = [] values.each{ |v| d << delete(v) } d end end #__TEST__ if __FILE__ == $0 require 'test/unit' class Tectcase < Test::Unit::TestCase def test_delete_values a = [1,2,3,4] assert_equal( [1,2], a.delete_values(1,2) ) assert_equal( [3,4], a ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-0.7.0 | lib/facet/array/delete_values.rb |
facets-0.7.1 | lib/facet/array/delete_values.rb |
facets-0.7.2 | lib/facet/array/delete_values.rb |