Class: Danger::FindRepoInfoFromURL
- Inherits:
-
Object
- Object
- Danger::FindRepoInfoFromURL
- Defined in:
- lib/danger/ci_source/support/find_repo_info_from_url.rb
Constant Summary collapse
- REGEXP =
%r{ (?<slug>[^/]+/[^/]+) (/(pull|merge_requests|pull-requests)/) (?<id>\d+) }x
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(url) ⇒ FindRepoInfoFromURL
constructor
A new instance of FindRepoInfoFromURL.
Constructor Details
#initialize(url) ⇒ FindRepoInfoFromURL
Returns a new instance of FindRepoInfoFromURL.
11 12 13 |
# File 'lib/danger/ci_source/support/find_repo_info_from_url.rb', line 11 def initialize(url) @url = url end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/danger/ci_source/support/find_repo_info_from_url.rb', line 15 def call matched = url.match(REGEXP) if matched RepoInfo.new(matched[:slug], matched[:id]) end end |