Sha256: 2932075eb72ab41be1fdd1daf0d76b454239f1ecafed033deed36049176f7628

Contents?: true

Size: 261 Bytes

Versions: 7

Compression:

Stored size: 261 Bytes

Contents

class Hash

  unless method_defined?(:select!)

    # In-place version of Hash#select.  The opposite of the built-in
    # Hash#reject!.
    #
    # CREDIT: Gavin Sinclair, Noah Gibbs

    def select!
      reject! { |k,v| not yield(k,v) }
    end

  end

end

Version data entries

7 entries across 6 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/hash/select.rb
facets-2.9.2 src/core/facets/hash/select.rb
facets-2.9.2 lib/core/facets/hash/select.rb
facets-2.9.1 lib/core/facets/hash/select.rb
facets-2.9.0 lib/core/facets/hash/select.rb
facets-2.9.0.pre.2 lib/core/facets/hash/select.rb
facets-2.9.0.pre.1 lib/core/facets/hash/select.rb