class Suspect::FileTree::Git::Snapshot

Attributes

client[R]

Public Class Methods

new(client = ::Suspect::FileTree::Git::Client.new) click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 7
def initialize(client = ::Suspect::FileTree::Git::Client.new)
  @client = client
end

Public Instance Methods

branch() click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 11
def branch
  without_new_line(client.branch)
end
commit_hash() click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 23
def commit_hash
  without_new_line(client.commit_hash)
end
files() click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 15
def files
  lines_to_files(client.files)
end
modified_files() click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 19
def modified_files
  lines_to_files(client.modified_files)
end
patch() click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 27
def patch
  client.diff
end

Private Instance Methods

lines_to_files(multiline_string) click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 39
def lines_to_files(multiline_string)
  multiline_string.split(/\n/).map {|path| "./#{path}"}
end
without_new_line(str) click to toggle source
# File lib/suspect/file_tree/git/snapshot.rb, line 35
def without_new_line(str)
  str.sub(/\n\z/, '')
end