lib/cfa/augeas_parser/writer.rb
# it returns variant of element that exists in path
it returns variant of element that exists in path
it returns variant of element that exists in path
def pick_candidate(paths, new_path, element)
        candidates = [element + "/", element + "[1]",
                      element.sub(/\[\d+\]/, ""), element]
        paths.each do |p|
          candidates.each do |c|
            return c if p.start_with?(new_path + c)
          end
        end
      end
def pick_candidate ( paths , new_path , element ) candidates = [ element + "/" , element + "[1]" , element . sub ( / \[ \d + \] / , "" ) , element ] paths . each do | p | candidates . each do | c | return c if p . start_with? ( new_path + c ) end end end
it returns variant of element that exists in path
it returns variant of element that exists in path
# NOTE: order here is important due to early matching
paths
<not_specific>
new_path
<not_specific>
element
<not_specific>