aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/compat
diff options
context:
space:
mode:
authorMarkus Reiter2016-10-04 10:31:49 +0200
committerGitHub2016-10-04 10:31:49 +0200
commitcafe1497808ef1ddb002061665ad606aa2340d10 (patch)
tree3020d12117601676f9afdf2cdefa86785546705b /Library/Homebrew/compat
parent881fdcd25ebe6b91691295034a8d9fa2dfc6f158 (diff)
parent9690c94f9dcc78d2a00093e21be412c70776541c (diff)
downloadbrew-cafe1497808ef1ddb002061665ad606aa2340d10.tar.bz2
Merge pull request #1145 from reitermarkus/module-function
Use `module_function` for `Homebrew` module.
Diffstat (limited to 'Library/Homebrew/compat')
-rw-r--r--Library/Homebrew/compat/global.rb16
1 files changed, 16 insertions, 0 deletions
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