aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2015-02-21 12:15:39 -0500
committerJack Nagel2015-02-21 12:26:14 -0500
commit97488d9053a623e7b383ce44a18be0b8789ec1b9 (patch)
tree0b8d1bd860f7e0e793cc73a969484f99f526ffd6
parent78c98e0f37b886fb7beca8c761648977d58470cd (diff)
downloadhomebrew-97488d9053a623e7b383ce44a18be0b8789ec1b9.tar.bz2
Eliminate conditional
-rw-r--r--Library/Homebrew/tab.rb15
-rw-r--r--Library/Homebrew/test/test_tab.rb2
2 files changed, 10 insertions, 7 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 530cee404..f077f6451 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -42,7 +42,7 @@ class Tab < OpenStruct
if path.exist?
from_file(path)
else
- dummy_tab
+ empty
end
end
@@ -83,16 +83,19 @@ class Tab < OpenStruct
tab = from_file(path)
used_options = remap_deprecated_options(f.deprecated_options, tab.used_options)
tab.used_options = used_options.as_flags
- tab
else
- dummy_tab(f)
+ tab = empty
+ tab.unused_options = f.options.as_flags
+ tab.source = { :path => f.path.to_s }
end
+
+ tab
end
- def self.dummy_tab f=nil
+ def self.empty
attributes = {
:used_options => [],
- :unused_options => f ? f.options.as_flags : [],
+ :unused_options => [],
:built_as_bottle => false,
:poured_from_bottle => false,
:tapped_from => "",
@@ -101,7 +104,7 @@ class Tab < OpenStruct
:stdlib => nil,
:compiler => "clang",
:source => {
- :path => f ? f.path.to_s : nil,
+ :path => nil,
},
}
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index ea38be87b..1ffa7fbb0 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -22,7 +22,7 @@ class TabTests < Homebrew::TestCase
end
def test_defaults
- tab = Tab.dummy_tab
+ tab = Tab.empty
assert_empty tab.unused_options
assert_empty tab.used_options
refute_predicate tab, :built_as_bottle