aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/extending.rb
blob: c3331ab47883382e20eccb00e11b6fe0ff7723d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
require 'active_support/core_ext/object/blank'

class Object
  def extended_by #:nodoc:
    ancestors = class << self; ancestors end
    ancestors.select { |mod| mod.class == Module } - [ Object, Kernel ]
  end

  def extend_with_included_modules_from(object) #:nodoc:
    object.extended_by.each { |mod| extend mod }
  end
end