Sha256: d8805041b3b6a38d245d74955697db9dac07435a21a3d94cf5b2ef0aa49ff9f2

Contents?: true

Size: 318 Bytes

Versions: 43

Compression:

Stored size: 318 Bytes

Contents

class Hash
  def keep_if
    return to_enum(:keep_if) unless block_given?
    delete_if{|key, value| ! yield key, value}
  end unless method_defined? :keep_if

  def select!(&block)
    return to_enum(:select!) unless block_given?
    reject!{|key, value| ! yield key, value}
  end unless method_defined? :select!
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
backports-1.16.3 lib/backports/1.9.2/hash.rb
backports-1.16.2 lib/backports/1.9.2/hash.rb
backports-1.16.1 lib/backports/1.9.2/hash.rb