Class: Snaptoken::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/snaptoken/diff.rb

Defined Under Namespace

Classes: DiffFile, DiffLine, DiffSection, HTMLLineByLine

Constant Summary collapse

GIT_DIFF_OPTIONS =

-r for recursive?

"--histogram --unified=100000 --ignore-space-change --no-index"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, step_a, step_b) ⇒ Diff

Returns a new instance of Diff.



7
8
9
10
11
12
13
14
15
16
# File 'lib/snaptoken/diff.rb', line 7

def initialize(config, step_a, step_b)
  git_diff = `git diff #{GIT_DIFF_OPTIONS} #{step_a.folder_name} #{step_b.folder_name}`
  parse_git_diff(git_diff)
  @files.values.each(&:omit_adjacent_removals!)

  @html = {}
  @files.each do |filename, file|
    @html[filename] = file.to_html(config, step_b)
  end
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



5
6
7
# File 'lib/snaptoken/diff.rb', line 5

def files
  @files
end

#htmlObject (readonly)

Returns the value of attribute html.



5
6
7
# File 'lib/snaptoken/diff.rb', line 5

def html
  @html
end