Welcome to mirror list, hosted at ThFree Co, Russian Federation.

util.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7973da2e8f8f9fd59e5151d0641b14bb58143b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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