Module: ObjectRubyExtended
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby_extended/object.rb', line 4 def self.included(base) base.class_eval do def dig(*items) res, all_items = self, items.flatten all_items.each do |item| next if res.nil? res = res[item] rescue nil end res end end end |