From bf40dd64dff1fc86b0ecbde33dc9e3be3ef3fccb Mon Sep 17 00:00:00 2001
From: Martin Afanasjew <martin@afanasjew.de>
Date: Fri, 8 Jul 2016 01:14:34 +0200
Subject: [PATCH] tab: eliminate redundant 'Tab.create' arguments (#468)

The `build` and `source_modified_time` arguments are always coming from
the matching attributes of the `Formula` instance. Thus query `formula`
for them instead of passing them individually.
---
 Library/Homebrew/build.rb | 3 ++-
 Library/Homebrew/tab.rb   | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index 1c95847191..8915e948cc 100644
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -131,7 +131,8 @@ class Build
         formula.install
 
         stdlibs = detect_stdlibs(ENV.compiler)
-        Tab.create(formula, ENV.compiler, stdlibs.first, formula.build, formula.source_modified_time).write
+        tab = Tab.create(formula, ENV.compiler, stdlibs.first)
+        tab.write
 
         # Find and link metafiles
         formula.prefix.install_metafiles formula.buildpath
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index a407496bb4..58eee94780 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -15,7 +15,8 @@ class Tab < OpenStruct
     CACHE.clear
   end
 
-  def self.create(formula, compiler, stdlib, build, source_modified_time)
+  def self.create(formula, compiler, stdlib)
+    build = formula.build
     attributes = {
       "used_options" => build.used_options.as_flags,
       "unused_options" => build.unused_options.as_flags,
@@ -23,7 +24,7 @@ class Tab < OpenStruct
       "built_as_bottle" => build.bottle?,
       "poured_from_bottle" => false,
       "time" => Time.now.to_i,
-      "source_modified_time" => source_modified_time.to_i,
+      "source_modified_time" => formula.source_modified_time.to_i,
       "HEAD" => HOMEBREW_REPOSITORY.git_head,
       "compiler" => compiler,
       "stdlib" => stdlib,
-- 
GitLab