Sha256: b33f64ec0b1a31cb70ddbf8c8a9b5647e799442a62f12ef3447b841bb0e36e2e

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

unless Hash.instance_methods.include? 'except'
  
  Hash.class_eval do
    
    # Returns a new hash without the given keys.
    def except(*keys)
      rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
      reject { |key,| rejected.include?(key) }
    end
 
    # Replaces the hash without only the given keys.
    def except!(*keys)
      replace(except(*keys))
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
decisiv-grouped_scope-0.5.1.1 test/lib/core_ext.rb
metaskills-grouped_scope-0.5.1 test/lib/core_ext.rb