Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save burke/293983 to your computer and use it in GitHub Desktop.
Save burke/293983 to your computer and use it in GitHub Desktop.
From e8391aaebdca619551ab0b1bd5e1b19091728c80 Mon Sep 17 00:00:00 2001
From: Burke Libbey <[email protected]>
Date: Wed, 3 Feb 2010 12:53:57 -0600
Subject: [PATCH] FIXED #methods to return class methods on the class of an instance of a metaclass
---
kernel/common/kernel.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/kernel/common/kernel.rb b/kernel/common/kernel.rb
index 3296ae0..edb8586 100644
--- a/kernel/common/kernel.rb
+++ b/kernel/common/kernel.rb
@@ -542,6 +542,9 @@ module Kernel
def methods(all=true)
methods = singleton_methods(all)
methods |= self.class.instance_methods(true) if all
+ if self.respond_to?(:__metaclass_object__)
+ methods |= self.__metaclass_object__.class.singleton_methods
+ end
return methods if kind_of?(ImmediateValue)
--
1.6.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment