class Manifestly::Diff

Attributes

files[R]

Public Class Methods

new(diff_string) click to toggle source
# File lib/manifestly/diff.rb, line 49
def initialize(diff_string)
  file_strings = diff_string.split("diff --git ")
  file_strings.reject!(&:blank?)
  file_strings.reject!{|str| str.starts_with?("commit ")} # from 'git show' output
  @files = file_strings.collect{|file_string| File.new(file_string)}
end

Public Instance Methods

[](index) click to toggle source
# File lib/manifestly/diff.rb, line 66
def [](index)
  files[index]
end
has_file?(filename) click to toggle source
# File lib/manifestly/diff.rb, line 58
def has_file?(filename)
  files.any?{|file| file.to_name == filename || file.from_name == filename}
end
num_files() click to toggle source
# File lib/manifestly/diff.rb, line 62
def num_files
  files.length
end