aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-26 18:00:45 +0200
committerMarkus Reiter2016-10-02 00:24:47 +0200
commitacaee035dfddd1fd90b883f19cb2c9f52852c2f3 (patch)
treede70003605814f6a398209edcaa308a3e753ac7b /Library
parent0ab750bf24dac2cb411d76c05a0edb9b1f1b9333 (diff)
downloadbrew-acaee035dfddd1fd90b883f19cb2c9f52852c2f3.tar.bz2
Add compatibility layer for `module Homebrew`.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/compat.rb1
-rw-r--r--Library/Homebrew/compat/global.rb16
2 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb
index eabc7dfa0..57c018c04 100644
--- a/Library/Homebrew/compat.rb
+++ b/Library/Homebrew/compat.rb
@@ -2,6 +2,7 @@ require "compat/fails_with_llvm"
require "compat/tap"
require "compat/formula"
require "compat/formula_specialties"
+require "compat/global"
require "compat/hardware"
require "compat/macos"
require "compat/md5"
diff --git a/Library/Homebrew/compat/global.rb b/Library/Homebrew/compat/global.rb
new file mode 100644
index 000000000..797e9ffe5
--- /dev/null
+++ b/Library/Homebrew/compat/global.rb
@@ -0,0 +1,16 @@
+module Homebrew
+ module_function
+
+ def method_missing(method, *args, &block)
+ if instance_methods.include?(method)
+ # odeprecated "#{self}##{method}", "'module_function' or 'def self.#{method}' to convert it to a class method"
+ return instance_method(method).bind(self).call(*args, &block)
+ end
+ super
+ end
+
+ def respond_to_missing?(method, include_private = false)
+ return true if method_defined?(method)
+ super(method, include_private)
+ end
+end