Parent

Methods

Diff::LCS::Block

A block is an operation removing, adding, or changing a group of items. Basically, this is just a list of changes, where each change adds or deletes a single item. Used by bin/ldiff.

Attributes

changes[R]
insert[R]
remove[R]

Public Class Methods

new(chunk) click to toggle source
    # File lib/diff/lcs/block.rb, line 23
23:   def initialize(chunk)
24:     @changes = []
25:     @insert = []
26:     @remove = []
27: 
28:     chunk.each do |item|
29:       @changes << item
30:       @remove << item if item.deleting?
31:       @insert << item if item.adding?
32:     end
33:   end

Public Instance Methods

diff_size() click to toggle source
    # File lib/diff/lcs/block.rb, line 35
35:   def diff_size
36:     @insert.size - @remove.size
37:   end
op() click to toggle source
    # File lib/diff/lcs/block.rb, line 39
39:   def op
40:     case [@remove.empty?, @insert.empty?]
41:     when [false, false]
42:       '!'
43:     when [false, true]
44:       '-'
45:     when [true, false]
46:       '+'
47:     else # [true, true]
48:       '^'
49:     end
50:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.