diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-27 10:13:50 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-27 10:13:50 +0000 |
commit | 935f8215371d68f36950c709061e5876ecadaa89 (patch) | |
tree | c6f55c027d3febebeb9704b364e0d7bacb9b0710 /activesupport/lib/active_support/core_ext/object/extending.rb | |
parent | f3560d5a956f13df0571471c63f05369b85ba67d (diff) | |
download | rails-935f8215371d68f36950c709061e5876ecadaa89.tar.gz rails-935f8215371d68f36950c709061e5876ecadaa89.tar.bz2 rails-935f8215371d68f36950c709061e5876ecadaa89.zip |
Object#copy_instance_variables_from Ruby 1.9 compat
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/extending.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/extending.rb | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/extending.rb b/activesupport/lib/active_support/core_ext/object/extending.rb index 19f42cabce..43a2be916e 100644 --- a/activesupport/lib/active_support/core_ext/object/extending.rb +++ b/activesupport/lib/active_support/core_ext/object/extending.rb @@ -24,25 +24,11 @@ class Object ancestors = class << self; ancestors end ancestors.select { |mod| mod.class == Module } - [ Object, Kernel ] end - - def copy_instance_variables_from(object, exclude = []) #:nodoc: - exclude += object.protected_instance_variables if object.respond_to? :protected_instance_variables - - instance_variables = object.instance_variables - exclude.map { |name| name.to_s } - instance_variables.each { |name| instance_variable_set(name, object.instance_variable_get(name)) } - end - + def extend_with_included_modules_from(object) #:nodoc: object.extended_by.each { |mod| extend mod } end - def instance_values #:nodoc: - instance_variables.inject({}) do |values, name| - values[name[1..-1]] = instance_variable_get(name) - values - end - end - unless defined? instance_exec # 1.9 module InstanceExecMethods #:nodoc: end |