Module: Jekyll::Minibundle::Hashes
- Defined in:
- lib/jekyll/minibundle/hashes.rb
Class Method Summary collapse
Class Method Details
.dig(obj, *keys) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/jekyll/minibundle/hashes.rb', line 3 def self.dig(obj, *keys) value = obj keys.each do |key| return nil unless value value = value[key] end value end |
.pick(hash, *keys) ⇒ Object
12 13 14 15 16 |
# File 'lib/jekyll/minibundle/hashes.rb', line 12 def self.pick(hash, *keys) keys.each_with_object({}) do |key, acc| acc[key] = hash.fetch(key) end end |