diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index fb633d66176b84526c44f7046b79401435c4dac6..1f04ef3ddeffde8bb69a455816305333567a9d3e 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -97,7 +97,7 @@ class Formulary
     def initialize path
       # require allows filenames to drop the .rb extension, but everything else
       # in our codebase will require an exact and fullpath.
-      path = "#{name}.rb" unless path =~ /\.rb$/
+      path = "#{path}.rb" unless path =~ /\.rb$/
 
       @path = Pathname.new(path)
       @name = @path.stem