Method: LostInTranslation.merge_hash
- Defined in:
- lib/lit/hash.rb
.merge_hash(merge_from, merge_to) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lit/hash.rb', line 12 def self.merge_hash(merge_from, merge_to) return if merge_from.is_a?(String) || merge_to.is_a?(String) merged_hash = merge_to first_key = merge_from.keys.first merged_hash[first_key] = if merge_to.key?(first_key) merge_hash(merge_from[first_key], merge_to[first_key]) else merge_from[first_key] end merged_hash end |