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 ...@@ -2,10 +2,8 @@ module Hbc
module QualifiedToken module QualifiedToken
def self.parse(arg) def self.parse(arg)
return nil unless arg.is_a?(String) return nil unless arg.is_a?(String)
return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX return nil unless match = arg.downcase.match(HOMEBREW_TAP_CASK_REGEX)
# eg caskroom/cask/google-chrome user, repo, token = match.captures
# per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
user, repo, token = arg.downcase.split("/")
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]" odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
[user, repo, token] [user, repo, token]
end 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