aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb b/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
new file mode 100644
index 000000000..48f8501e5
--- /dev/null
+++ b/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
@@ -0,0 +1,12 @@
+require "hbc/source/tapped"
+
+class Hbc::Source::TappedQualified < Hbc::Source::Tapped
+ def self.me?(query)
+ !Hbc::QualifiedToken.parse(query).nil? && path_for_query(query).exist?
+ end
+
+ def self.path_for_query(query)
+ user, repo, token = Hbc::QualifiedToken.parse(query)
+ Tap.new(user, repo).cask_dir.join(token.sub(%r{(\.rb)?$}i, ".rb"))
+ end
+end