Class: GitDiffLcs::Stat
- Inherits:
-
Object
- Object
- GitDiffLcs::Stat
- Defined in:
- lib/git_diff_lcs/stat.rb
Overview
Stat
Constant Summary collapse
- SRC_FOLDER =
"src_#{SecureRandom.uuid}"- DEST_FOLDER =
"dest_#{SecureRandom.uuid}"- INIT_COUNT =
[0, 0, 0].freeze
Instance Method Summary collapse
- #deletions ⇒ Object
-
#initialize(repo, src, dest) ⇒ Stat
constructor
repo(String) : git repository address src(String) : src commit or branch dest(String) : dest commit or branch.
- #insertions ⇒ Object
- #modifications ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(repo, src, dest) ⇒ Stat
repo(String) : git repository address src(String) : src commit or branch dest(String) : dest commit or branch
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/git_diff_lcs/stat.rb', line 18 def initialize(repo, src, dest) @go_next = false @dir = Dir.mktmpdir @add, @del, @mod = *INIT_COUNT @target_files = [] @diff = git_clone(repo, src, dest).diff(src, dest) @target_files = @diff.name_status.keys calculate rescue Git::GitExecuteError puts "[ERROR] wrong git info(repo or src or dest)" end |
Instance Method Details
#deletions ⇒ Object
41 42 43 |
# File 'lib/git_diff_lcs/stat.rb', line 41 def deletions @del end |
#insertions ⇒ Object
37 38 39 |
# File 'lib/git_diff_lcs/stat.rb', line 37 def insertions @add end |
#modifications ⇒ Object
45 46 47 |
# File 'lib/git_diff_lcs/stat.rb', line 45 def modifications @mod end |
#summary ⇒ Object
31 32 33 34 35 |
# File 'lib/git_diff_lcs/stat.rb', line 31 def summary total = @add + @del + @mod changed = @target_files.size "#{changed} files changed, #{@add} insertions(+), #{@del} deletions(-), #{@mod} modifications(!), total(#{total})" end |