Class: HelixSync::Methods::Subplan

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/helix_sync/methods.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) head_delete?

Returns:

  • (Boolean)


561
562
563
# File 'lib/helix_sync/methods.rb', line 561

def head_delete?
  %w(delete move/delete).include?(self.headAction)
end

- (Boolean) locked_by_other_than?(user)

Returns true if the subplan contains an “otherLock” that is not the indicated user

Returns:

  • (Boolean)


555
556
557
558
559
# File 'lib/helix_sync/methods.rb', line 555

def locked_by_other_than?(user)
  !self.otherLock.nil? &&
      self.otherLock.is_a?(Array) &&
      self.otherLock.any?{ |l| l.start_with?("#{user}@") }
end

- (Object) sync_conflict



565
566
567
568
569
570
571
572
573
# File 'lib/helix_sync/methods.rb', line 565

def sync_conflict
  if self.action == 'delete'
    head_delete? ? 'remove' : 'resolve'
  elsif self.action == 'add' || self.action == 'edit'
    head_delete? ? 'readd' : 'resolve'
  else
    'unknown'
  end
end

- (Object) to_json(*a)



575
576
577
# File 'lib/helix_sync/methods.rb', line 575

def to_json(*a)
  to_h.to_json
end