From ffd92a87c5e0503c1ca63c52d54332c2c93618c2 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sat, 23 May 2015 18:08:07 +0800 Subject: [PATCH] tab: allow load from file content --- Library/Homebrew/tab.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index efc7466287..85252ab604 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -31,7 +31,11 @@ class Tab < OpenStruct end def self.from_file path - attributes = Utils::JSON.load(File.read(path)) + from_file_content(File.read(path), path) + end + + def self.from_file_content content, path + attributes = Utils::JSON.load(content) attributes["tabfile"] = path attributes["source"] ||= {}