Class: Hash
Overview
also deep now.
Instance Method Summary collapse
-
#reverse_significant_merge(other_hash = {}) ⇒ Object
need to call significant on self now.
-
#reverse_significant_merge!(other_hash = {}) ⇒ Object
or keep_significant for destructive.
- #significant ⇒ Object
-
#significant_merge(other_hash = {}) ⇒ Object
also allows nil so we don’t need Something.new(params.merge(params || {})).
-
#significant_merge!(other_hash = {}) ⇒ Object
destructive.
Instance Method Details
#reverse_significant_merge(other_hash = {}) ⇒ Object
need to call significant on self now.
19 20 21 22 |
# File 'lib/significance/core_ext/hash.rb', line 19 def reverse_significant_merge(other_hash={}) return significant if (other_hash ||= {}).blank? significant.reverse_merge(other_hash) end |
#reverse_significant_merge!(other_hash = {}) ⇒ Object
or keep_significant for destructive
24 25 26 27 |
# File 'lib/significance/core_ext/hash.rb', line 24 def reverse_significant_merge!(other_hash={}) return keep_significant if (other_hash ||= {}).blank? keep_significant.reverse_merge!(other_hash) end |
#significant ⇒ Object
4 5 6 |
# File 'lib/significance/core_ext/hash.rb', line 4 def significant Hash.new.tap { |hsh| each(&significance_each_block(hsh)) } end |
#significant_merge(other_hash = {}) ⇒ Object
also allows nil so we don’t need Something.new(params.merge(params || {}))
9 10 11 12 |
# File 'lib/significance/core_ext/hash.rb', line 9 def significant_merge(other_hash={}) return self unless (other_hash ||= {}).significant.present? merge(other_hash.significant) end |
#significant_merge!(other_hash = {}) ⇒ Object
destructive
14 15 16 17 |
# File 'lib/significance/core_ext/hash.rb', line 14 def significant_merge!(other_hash={}) return self unless (other_hash ||= {}).significant.present? merge!(other_hash.significant) end |