Class/Module Index [+]

Quicksearch

Ruote::Exp::MergeMixin

Gathering methods for merging workitems.

Public Instance Methods

merge_workitems(index, target, source, type) click to toggle source

Merge workitem 'source' into workitem 'target'.

If type is 'override', the source will prevail and be returned.

If type is 'mix', the source fields will be merge into the target fields.

If type is 'isolate', the source fields will be placed in a separte field in the target workitem. The name of this field is the child_id of the source workitem (a string from '0' to '99999' and beyond)

# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.