Module: PrestaShopAutomationTool

Defined in:
lib/prestashop-automation-tool.rb

Defined Under Namespace

Classes: ConfigurationParser

Class Method Summary collapse

Class Method Details

.gem_rootObject



7
8
9
# File 'lib/prestashop-automation-tool.rb', line 7

def self.gem_root
  File.expand_path '../..', __FILE__
end

.merge(a, b) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/prestashop-automation-tool.rb', line 11

def self.merge a, b
  if a.is_a? Hash and b.is_a? Hash
    merged = {}

    a.each_pair do |ka, va|
      if b.has_key? ka
        merged[ka] = merge va, b[ka]
      else
        merged[ka] = va
      end
    end

    b.each_pair do |kb, vb|
      unless a.has_key? kb
        merged[kb] = vb
      end
    end

    return merged
  else
    return b
  end
end