Module: Jekyll::Minibundle::Hashes

Defined in:
lib/jekyll/minibundle/hashes.rb

Class Method Summary collapse

Class Method Details

.dig(obj, *keys) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/jekyll/minibundle/hashes.rb', line 5

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



15
16
17
# File 'lib/jekyll/minibundle/hashes.rb', line 15

def self.pick(hash, *keys)
  keys.to_h { |key| [key, hash.fetch(key)] }
end