From 72f4323ea56e1715fa54a39faf39cf8dbd53c2ba Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 6 Dec 2015 22:33:41 +0800 Subject: [PATCH] Tab#tap: returns tap object --- Library/Homebrew/tab.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index c594843f6d..984b587ff5 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -28,7 +28,7 @@ class Tab < OpenStruct "stdlib" => stdlib, "source" => { "path" => formula.path.to_s, - "tap" => formula.tap, + "tap" => formula.tap ? formula.tap.name : nil, "spec" => formula.active_spec_sym.to_s } } @@ -116,7 +116,11 @@ class Tab < OpenStruct else tab = empty tab.unused_options = f.options.as_flags - tab.source = { "path" => f.path.to_s, "tap" => f.tap, "spec" => f.active_spec_sym.to_s } + tab.source = { + "path" => f.path.to_s, + "tap" => f.tap ? f.tap.name : f.tap, + "spec" => f.active_spec_sym.to_s, + } end tab @@ -194,11 +198,13 @@ class Tab < OpenStruct end def tap - source["tap"] + tap_name = source["tap"] + Tap.fetch(tap_name) if tap_name end def tap=(tap) - source["tap"] = tap + tap_name = tap.respond_to?(:name) ? tap.name : tap + source["tap"] = tap_name end def spec