Class: LockDiff::Github::RepositoryNameDetector
- Inherits:
-
Object
- Object
- LockDiff::Github::RepositoryNameDetector
- Defined in:
- lib/lock_diff/github/repository_name_detector.rb
Constant Summary collapse
- REGEXP =
%r!github\.com[/:](.*?)(?:.git)?\z!
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(url) ⇒ RepositoryNameDetector
constructor
A new instance of RepositoryNameDetector.
Constructor Details
#initialize(url) ⇒ RepositoryNameDetector
6 7 8 |
# File 'lib/lock_diff/github/repository_name_detector.rb', line 6 def initialize(url) @url = url end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 |
# File 'lib/lock_diff/github/repository_name_detector.rb', line 10 def call return unless @url @url.match(REGEXP).to_a.last. split("/").first(2). join("/") end |