aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/instance_variables.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-09-27 09:26:46 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-09-27 09:26:46 +0000
commitd96e38be9992e0fe93668ab46d9442f702d370dd (patch)
tree0ae2dc949e6488b01c5bdd6ab6f01858210859c4 /activesupport/lib/active_support/core_ext/object/instance_variables.rb
parent7974f4752b9b4e2bc59f8e611737ff59889867b4 (diff)
downloadrails-d96e38be9992e0fe93668ab46d9442f702d370dd.tar.gz
rails-d96e38be9992e0fe93668ab46d9442f702d370dd.tar.bz2
rails-d96e38be9992e0fe93668ab46d9442f702d370dd.zip
Backport Object#instance_variable_defined? for Ruby < 1.8.6.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7649 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.rb8
1 files changed, 8 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
new file mode 100644
index 0000000000..72eaed70b6
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
@@ -0,0 +1,8 @@
+class Object
+ # Available in 1.8.6 and later.
+ unless respond_to?(:instance_variable_defined?)
+ def instance_variable_defined?(variable)
+ instance_variables.include?(variable.to_s)
+ end
+ end
+end