# File lib/ruote/exp/merge.rb, line 44
    def merge_workitems (index, target, source, type)

      return source if type == 'override'

      if target == nil
        case type
          when 'isolate'
            source['fields'] = { index.to_s => source['fields'] }
          when 'stack'
            source['fields'] = { 'stack' => [ source['fields'] ] }
        end
      end

      return source unless target

      case type
        when 'mix'
          target['fields'].merge!(source['fields'])
        when 'stack'
          target['fields']['stack'] << source['fields']
          target['fields']['stack_attributes'] = expand_atts
        else # 'isolate'
          target['fields'][index.to_s] = source['fields']
      end

      target
    end