Sha256: b3e5a0e0102da8209a64c17da90748531c15ddeb10fde70cbd2e4bdf9d5b331b

Contents?: true

Size: 469 Bytes

Versions: 51

Compression:

Stored size: 469 Bytes

Contents

unless {}.respond_to? :slice
  class Hash
    def slice(*keys)
      allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
      hash = {}
      allowed.each { |k| hash[k] = self[k] if has_key?(k) }
      hash
    end

    def slice!(*keys)
      keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
      omit = slice(*self.keys - keys)
      hash = slice(*keys)
      replace(hash)
      omit
    end
  end
end

Version data entries

51 entries across 41 versions & 4 rubygems

Version Path
riak-client-1.1.1 lib/riak/core_ext/slice.rb
riak-client-1.1.0 lib/riak/core_ext/slice.rb
better-riak-client-1.0.7 lib/riak/core_ext/slice.rb
better-riak-client-1.0.6 lib/riak/core_ext/slice.rb
riak-client-1.0.5 lib/riak/core_ext/slice.rb
better-riak-client-1.0.5 lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.0/lib/riak/core_ext/slice.rb
riak-client-1.0.3 lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.0/lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/lib/riak/core_ext/slice.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/lib/riak/core_ext/slice.rb
riak-client-1.0.2 pkg/riak-client-1.0.0/lib/riak/core_ext/slice.rb
riak-client-1.0.2 lib/riak/core_ext/slice.rb
riak-client-1.0.2 pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/core_ext/slice.rb
riak-client-1.0.2 pkg/riak-client-1.0.1/lib/riak/core_ext/slice.rb
riak-client-1.0.0 lib/riak/core_ext/slice.rb
seomoz-riak-client-1.0.0.pre lib/riak/core_ext/slice.rb