aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/metaclass.rb
blob: 93fb0ad594c51e943b5758c9f1f2c891219b0e8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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