Skip to content
Snippets Groups Projects
Commit b2870c24 authored by Josh Hagins's avatar Josh Hagins
Browse files

hbc/qualified_token: use regex captures instead of String#split

parent c7e6613f
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,8 @@ module Hbc
module QualifiedToken
def self.parse(arg)
return nil unless arg.is_a?(String)
return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX
# eg caskroom/cask/google-chrome
# per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
user, repo, token = arg.downcase.split("/")
return nil unless match = arg.downcase.match(HOMEBREW_TAP_CASK_REGEX)
user, repo, token = match.captures
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
[user, repo, token]
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment