features/support/route.rb
# Overwriters the default values in defaults.
# e.g. [[a, 1], [b, 2]], [[a, 5], [d, 10]] => [[a, 5], [b, 2], [d, 10]]
Overwriters the default values in defaults.
Overwriters the default values in defaults .
def overwrite_params defaults, other
  merged = []
  defaults.each do |k,v|
    idx = other.index { |p| p[0] == k }
    if idx == nil then
      merged << [k, v]
    else
      merged << [k, other[idx][1]]
    end
  end
  other.each do |k,v|
    if merged.index { |pair| pair[0] == k} == nil then
      merged << [k, v]
    end
  end
  return merged
end
def overwrite_params defaults , other merged = [ ] defaults . each do | k , v | idx = other . index { | p | p [ 0 ] == k } if idx == nil then merged << [ k , v ] else merged << [ k , other [ idx ] [ 1 ] ] end end other . each do | k , v | if merged . index { | pair | pair [ 0 ] == k } == nil then merged << [ k , v ] end end return merged end
Overwriters the default values in defaults.
Overwriters the default values in defaults .
defaults
<not_specific>
other
<not_specific>