diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-01-04 21:43:06 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-01-05 03:09:28 +0300 |
commit | a00578ce5cdf4bab95990bca9e806c6322bb1384 (patch) | |
tree | 5aafe058fa55086038dbb3086121ad624447c0e4 /lib/gitlab/git/util.rb | |
parent | aec04a47c16665f1dfb1fb61647c3f78a4dde20f (diff) |
Absorb gitlab_git
Diffstat (limited to 'lib/gitlab/git/util.rb')
-rw-r--r-- | lib/gitlab/git/util.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/git/util.rb b/lib/gitlab/git/util.rb new file mode 100644 index 00000000000..7973da2e8f8 --- /dev/null +++ b/lib/gitlab/git/util.rb @@ -0,0 +1,18 @@ +module Gitlab + module Git + module Util + LINE_SEP = "\n".freeze + + def self.count_lines(string) + case string[-1] + when nil + 0 + when LINE_SEP + string.count(LINE_SEP) + else + string.count(LINE_SEP) + 1 + end + end + end + end +end |