disu.se

OperationClass

Namespace

Lookout::Diff

Ancestors
  1. Value

  2. Object

Subclasses
Copy

Slice that should be copied from the old sequence.

Delete

Slice that should be deleted from the old sequence.

Insert

Slice that should be inserted from the new sequence.

Replace

Slice of the old sequence that should be replaced with one from the new sequence.

Base class for operations describing the changes to perform to get from the old version of a sequence to the new in a “diff”.

Constructor

initialize(oldSlice, newSlice)#

Initializes the operation with the slices of the old and new sequences.

Instance Methods

foldable?(contextInteger)Boolean#

Returns true if the operation is uninteresting to the actual “diff” and can be meaningfully folded, leaving context elements.

See Also

Operations::Copy#foldable?

>>(contextInteger)self#

Folds from the beginning of the receiver, leaving context elements.

Note

Logically, the receiver should be #foldable? inside context, but this isn’t enforced.

<<(contextInteger)self#

Folds from the end of the receiver, leaving context elements.

Note

Logically, the receiver should be #foldable? inside context, but this isn’t enforced.

parity?Boolean#

Returns true if the receiver represents parity.

See Also

Operations::Copy#parity?

apply(objectObject)#

Implements a double dispatch for enumerating operations, where object is sent the last part of the receiver’s class’ name with the receiver as the lone argument.

ReturnsObject

The result of object#name(self)

oldSlice#

Returns the slice of the old sequence.

newSlice#

Returns the slice of the new sequence.