From 4ae48289534ae88786eef6f5cd1abce5ee2de49e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 16 Jul 2010 08:41:53 -0700 Subject: [PATCH] backporting a couple missing files. sorry folks! --- .../core_ext/kernel/singleton_class.rb | 13 +++++++++++++ .../active_support/core_ext/module/remove_method.rb | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 activesupport/lib/active_support/core_ext/kernel/singleton_class.rb create mode 100644 activesupport/lib/active_support/core_ext/module/remove_method.rb 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 diff --git a/activesupport/lib/active_support/core_ext/module/remove_method.rb b/activesupport/lib/active_support/core_ext/module/remove_method.rb new file mode 100644 index 0000000000..2714a46b28 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb @@ -0,0 +1,6 @@ +class Module + def remove_possible_method(method) + remove_method(method) + rescue NameError + end +end \ No newline at end of file -- GitLab