Module: Caracara::Utils

Defined in:
lib/caracara/utils.rb

Class Method Summary collapse

Class Method Details

.merge(a, b) ⇒ Object

Merge the options in an intelligent way



5
6
7
8
9
10
11
12
13
# File 'lib/caracara/utils.rb', line 5

def self.merge(a, b)
  a.merge(b) do |key, oldval, newval|
    # Return if both of the values are Hash instances
    next merge(oldval, newval) if oldval.is_a?(Hash) && newval.is_a?(Hash)

    # Return the value
    newval
  end
end