aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/kernel/singleton_class.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/singleton_class.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb b/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb
new file mode 100644
index 0000000000..33612155fb
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb
@@ -0,0 +1,13 @@
+module Kernel
+ # Returns the object's singleton class.
+ def singleton_class
+ class << self
+ self
+ end
+ end unless respond_to?(:singleton_class) # exists in 1.9.2
+
+ # class_eval on an object acts like singleton_class.class_eval.
+ def class_eval(*args, &block)
+ singleton_class.class_eval(*args, &block)
+ end
+end