aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/metaclass.rb
diff options
context:
space:
mode:
authorrick <technoweenie@gmail.com>2008-08-26 11:53:33 -0700
committerrick <technoweenie@gmail.com>2008-08-26 11:53:33 -0700
commit0aef9d1a2651fa0acd2adcd2de308eeb0ec8cdd2 (patch)
tree1a782151632dd80c8a18c3960536bdf8643debe3 /activesupport/lib/active_support/core_ext/object/metaclass.rb
parent0a6d75dedd79407376aae1f01302164dfd3e44b6 (diff)
parent229eedfda87a7706dbb5e3e51af8707b3adae375 (diff)
downloadrails-0aef9d1a2651fa0acd2adcd2de308eeb0ec8cdd2.tar.gz
rails-0aef9d1a2651fa0acd2adcd2de308eeb0ec8cdd2.tar.bz2
rails-0aef9d1a2651fa0acd2adcd2de308eeb0ec8cdd2.zip
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/metaclass.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/object/metaclass.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/metaclass.rb b/activesupport/lib/active_support/core_ext/object/metaclass.rb
new file mode 100644
index 0000000000..93fb0ad594
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/object/metaclass.rb
@@ -0,0 +1,13 @@
+class Object
+ # Get object's meta (ghost, eigenclass, singleton) class
+ def metaclass
+ class << self
+ self
+ end
+ end
+
+ # If class_eval is called on an object, add those methods to its metaclass
+ def class_eval(*args, &block)
+ metaclass.class_eval(*args, &block)
+ end
+end