app/lib/chief.rb
# Given two changesets, produce merged "best" version
# When confidence is the same, c1 wins.
Given two changesets, produce merged "best" version
When confidence is the same, c1 wins.
Given two changesets produce merged " best " version When confidence is the same c1 wins .
def merge_changeset(c1, c2)
    result = c1.dup
    c2.each do |field, data|
      if !result.key?(field) ||
         (data[:confidence] > result[field][:confidence])
        result[field] = data
      end
    end
    result
  end
def merge_changeset ( c1 , c2 ) result = c1 . dup c2 . each do | field , data | if ! result . key? ( field ) || ( data [ :confidence ] > result [ field ] [ :confidence ] ) result [ field ] = data end end result end
Given two changesets, produce merged "best" version
When confidence is the same, c1 wins.
Given two changesets produce merged " best " version When confidence is the same c1 wins .
c1
<not_specific>
c2
<not_specific>