Class: Hash

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

Overview

Yay for Ruby 2.0!

Instance Method Summary collapse

Instance Method Details

#dig(*args) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/showoff/monkeypatches.rb', line 4

def dig(*args)
  args.reduce(self) do |iter, arg|
    break nil unless iter.is_a? Enumerable
    break nil unless iter.include? arg
    iter[arg]
  end
end