lib/active_object/hash.rb in active_object-5.13.0 vs lib/active_object/hash.rb in active_object-5.14.0

- old
+ new

@@ -23,9 +23,26 @@ else assert_valid_keys(*valid_keys) end end + # rubocop:disable Style/GuardClause + def bury(*args) + if args.count < 2 + raise ArgumentError, '2 or more arguments required' + elsif args.count == 2 + self[args[0]] = args[1] + else + arg = args.shift + + self[arg] = {} unless self[arg] + self[arg].bury(*args) unless args.empty? + end + + self + end + # rubocop:enable Style/GuardClause + def compact select { |_, val| !val.nil? } end def compact!