Sha256: ede7e83bf83ddf17bc0c7c9b2ef6009100132cffd9ff020d1f19f12eb4feb6e8
Contents?: true
Size: 730 Bytes
Versions: 2
Compression:
Stored size: 730 Bytes
Contents
module Atlassian module Util module TextUtil def convert_branch_name_to_sentence(branch_name) return '' if branch_name.nil? branch_name = branch_name.to_s return '' if branch_name.empty? issue_key_regex = /([A-Z]{1,10}-\d+)/ branch_components = branch_name.split(issue_key_regex); parts = branch_components.each_with_index.map { |value, index| (index % 2 === 0) ? value.gsub(/[\-_]/, ' ') : value } to_sentence_case(parts.join('')) end def to_sentence_case(str) return '' if str.nil? str = str.to_s return '' if str.empty? str[0].upcase + str.slice(1, str.length) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
atlassian-stash-0.1.9 | lib/atlassian/util/text_util.rb |
atlassian-stash-0.1.8 | lib/atlassian/util/text_util.rb |