diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-02-25 10:57:29 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-02-25 10:57:29 -0800 |
commit | 0b87d114bde73cddb9401d061acc1f2f4b3e1dfc (patch) | |
tree | e418a84374a77f64759e637ee88560ea47de4139 /activesupport/lib | |
parent | c7f9e8c06cb60aef33cf0a03cb3c1b927eb8c1cf (diff) | |
download | rails-0b87d114bde73cddb9401d061acc1f2f4b3e1dfc.tar.gz rails-0b87d114bde73cddb9401d061acc1f2f4b3e1dfc.tar.bz2 rails-0b87d114bde73cddb9401d061acc1f2f4b3e1dfc.zip |
Missed singleton_class
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/singleton_class.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/singleton_class.rb b/activesupport/lib/active_support/core_ext/object/singleton_class.rb new file mode 100644 index 0000000000..8dee54e71b --- /dev/null +++ b/activesupport/lib/active_support/core_ext/object/singleton_class.rb @@ -0,0 +1,13 @@ +class Object + # Returns the object's singleton class. + def singleton_class + class << self + self + end + end unless respond_to?(:singleton_class) + + # class_eval on an object acts like singleton_class_eval. + def class_eval(*args, &block) + singleton_class.class_eval(*args, &block) + end +end |