diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-04-21 12:03:01 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-04-21 12:03:01 +0100 |
commit | 6dbe90dd9b287ca383de9bae371614352a8646e7 (patch) | |
tree | aeb609165cf1da022e5472cb319345477f587f8b /activesupport/lib/active_support | |
parent | a04f0228776e7616c372f867a1212b5798cde80a (diff) | |
download | rails-6dbe90dd9b287ca383de9bae371614352a8646e7.tar.gz rails-6dbe90dd9b287ca383de9bae371614352a8646e7.tar.bz2 rails-6dbe90dd9b287ca383de9bae371614352a8646e7.zip |
Alias Object#instance_variable_names to Object#instance_variables for Ruby 1.8.x
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/instance_variables.rb | 8 |
1 files changed, 6 insertions, 2 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 ee1010b250..9f1d4ed2aa 100644 --- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb +++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb @@ -33,8 +33,12 @@ class Object # end # # C.new(0, 1).instance_variable_names # => ["@y", "@x"] - def instance_variable_names - instance_variables.map(&:to_s) + if RUBY_VERSION >= '1.9' + def instance_variable_names + instance_variables.map(&:to_s) + end + else + alias_method :instance_variable_names, :instance_variables end # Copies the instance variables of +object+ into +self+. |