Sha256: 1d1cfb7bde7bf8c860589c6959d04dacde65be3c214ccc9274dc01d97a71267e

Contents?: true

Size: 296 Bytes

Versions: 4

Compression:

Stored size: 296 Bytes

Contents

class Hash
  def symbolize_keys
    inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gamebox-0.5.5 lib/gamebox/lib/hash_ext.rb
gamebox-0.5.4 lib/gamebox/lib/hash_ext.rb
gamebox-0.5.2 lib/gamebox/lib/hash_ext.rb
gamebox-0.5.1 lib/gamebox/lib/hash_ext.rb