aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/instance_variables.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-28 05:42:12 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-28 05:42:12 +0000
commit7555073803ffb455715b74664a0cfb48c271fe89 (patch)
treec3729911796be98a9ad48c5bee6da6402f050ffb /activesupport/lib/active_support/core_ext/object/instance_variables.rb
parent16558f6dd83d514f783ed13e9bc24d6b66e5aefd (diff)
downloadrails-7555073803ffb455715b74664a0cfb48c271fe89.tar.gz
rails-7555073803ffb455715b74664a0cfb48c271fe89.tar.bz2
rails-7555073803ffb455715b74664a0cfb48c271fe89.zip
Ruby 1.9 compat: introduce instance_variable_names. Closes #10630 [Frederick Cheung]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8499 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/instance_variables.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/object/instance_variables.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
index e07eb76c1d..57276135c4 100644
--- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb
+++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
@@ -13,6 +13,10 @@ class Object
end
end
+ def instance_variable_names
+ instance_variables.map(&:to_s)
+ end
+
def copy_instance_variables_from(object, exclude = []) #:nodoc:
exclude += object.protected_instance_variables if object.respond_to? :protected_instance_variables