Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/rakumarket.rb

Instance Method Summary collapse

Instance Method Details

#slice(*keys) ⇒ Object



54
55
56
57
# File 'lib/rakumarket.rb', line 54

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

#symbolify_keys!Object



59
60
61
62
63
64
65
66
# File 'lib/rakumarket.rb', line 59

def symbolify_keys!
  self.keys.each do |k|
    unless Symbol === k
      self[k.to_sym] = self.delete(k)
    end
  end
  self
end