From 02b8d343399dcc367c04da1838ef3e4df3131495 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 23 Jan 2013 00:26:24 -0600 Subject: [PATCH] Tab#with? to mirror BuildOptions#with? Eventually a common interface could be factored out into a module, but for now this will suffice. --- Library/Homebrew/tab.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 6735efe5de..20f7b729b4 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -58,10 +58,24 @@ class Tab < OpenStruct :HEAD => nil end - def installed_with? opt + def with? name + if options.include? "with-#{name}" + used_options.include? "with-#{name}" + elsif options.include? "without-#{name}" + not used_options.include? "without-#{name}" + else + false + end + end + + def include? opt used_options.include? opt end + def universal? + used_options.include? "universal" + end + def used_options Options.new(super.map { |o| Option.new(o) }) end