Class: Dpu::ScmService::Base
- Inherits:
-
Object
- Object
- Dpu::ScmService::Base
- Defined in:
- lib/dpu/scm_service/base.rb
Instance Method Summary collapse
- #determine_fragment(start_line_number, end_line_number) ⇒ Object
- #determine_repository_uri(repository_http_or_ssh_url) ⇒ Object
- #ref_prefix ⇒ Object
Instance Method Details
#determine_fragment(start_line_number, end_line_number) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/dpu/scm_service/base.rb', line 17 def determine_fragment(start_line_number, end_line_number) return nil if !start_line_number return "L#{start_line_number}" if !end_line_number || start_line_number == end_line_number return self.class::START_AND_END_LINE_NUMBER_FRAGMENT_TEMPLATE % { start_line_number: start_line_number, end_line_number: end_line_number, } end |
#determine_repository_uri(repository_http_or_ssh_url) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/dpu/scm_service/base.rb', line 2 def determine_repository_uri(repository_http_or_ssh_url) md = self.class::REMOTE_URL_PATTERN.match(repository_http_or_ssh_url) return nil if !md url = self.class::REPOSITORY_URI_TEMPLATE % { account_name: md[:account_name], repository_name: md[:repository_name], } return URI(url) end |
#ref_prefix ⇒ Object
13 14 15 |
# File 'lib/dpu/scm_service/base.rb', line 13 def ref_prefix return self.class::REF_PREFIX end |