class Hash
/* Copyright 2013 Proofpoint, Inc. All rights reserved.
Copyright 2014 Evernote Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */
Public Instance Methods
deep_soft_merge(other)
click to toggle source
# File lib/ncc/instance.rb, line 21 def deep_soft_merge(other) r = self.dup other.each_pair do |key, value| if r.has_key? key if r[key].respond_to? :to_hash and other[key].respond_to? :to_hash r[key] = r[key].to_hash.deep_soft_merge(other[key].to_hash) end else r[key] = value end end r end
delete_nil_values()
click to toggle source
# File lib/ncc/instance.rb, line 37 def delete_nil_values self.keys.each { |k| delete(k) if self[k].nil? } self end