diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index 4c2a5e8ec8..c0b920b2cf 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -156,6 +156,7 @@ end # This class holds the build-time options defined for a Formula, # and provides named access to those options during install. class BuildOptions + include Enumerable def initialize args # Take a copy of the args (any string array, actually) @@ -181,19 +182,15 @@ class BuildOptions end def has_option? name - @options.any? {|o| o[0] == name} + @options.any? { |opt, _| opt == name } end def empty? @options.empty? end - def collect - @options.collect {|o| yield o[0], o[1]} - end - def each - @options.each {|o| yield o[0], o[1]} + @options.each { |opt, desc| yield opt, desc } end def include? name diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 78e1bdab50..0d93c46ae5 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -13,7 +13,7 @@ class Tab < OpenStruct arg_options = args.options_only # Pick off the option flags from the formula's `options` array by # discarding the descriptions. - formula_options = f.options.map { |o, _| o } + formula_options = f.build.map { |opt, _| "--#{opt}" } Tab.new :used_options => formula_options & arg_options, :unused_options => formula_options - arg_options, @@ -67,7 +67,7 @@ class Tab < OpenStruct def self.dummy_tab f Tab.new :used_options => [], - :unused_options => f.options.map { |o, _| o}, + :unused_options => f.build.map { |opt, _| "--#{opt}" }, :built_bottle => false, :tapped_from => "" end